Download src/Assistant/Application/CommandHandlers/CountAssistantsCommandHandler.php from pnacorp/AIKEEDO: direct link, hf CLI and curl.
- Browser
- Download file 791 Bytes
-
https://huggingface.co/pnacorp/AIKEEDO/resolve/main/src/Assistant/Application/CommandHandlers/CountAssistantsCommandHandler.php
- Command line
-
hf download hf://pnacorp/AIKEEDO/src/Assistant/Application/CommandHandlers/CountAssistantsCommandHandler.php
-
curl -L -o CountAssistantsCommandHandler.php https://huggingface.co/pnacorp/AIKEEDO/resolve/main/src/Assistant/Application/CommandHandlers/CountAssistantsCommandHandler.php
791 Bytes
| declare(strict_types=1); | |
| namespace Assistant\Application\CommandHandlers; | |
| use Assistant\Application\Commands\CountAssistantsCommand; | |
| use Assistant\Domain\Repositories\AssistantRepositoryInterface; | |
| class CountAssistantsCommandHandler | |
| { | |
| public function __construct( | |
| private AssistantRepositoryInterface $repo | |
| ) {} | |
| public function handle(CountAssistantsCommand $cmd): int | |
| { | |
| $assistants = $this->repo; | |
| if ($cmd->ids) { | |
| $assistants = $assistants->filterById($cmd->ids); | |
| } | |
| if ($cmd->query) { | |
| $assistants = $assistants->search($cmd->query); | |
| } | |
| if ($cmd->status) { | |
| $assistants = $assistants->filterByStatus($cmd->status); | |
| } | |
| return $assistants->count(); | |
| } | |
| } | |