Download src/Affiliate/Application/CommandHandlers/CountPayoutsCommandHandler.php from pnacorp/AIKEEDO: direct link, hf CLI and curl.
- Browser
- Download file 664 Bytes
-
https://huggingface.co/pnacorp/AIKEEDO/resolve/main/src/Affiliate/Application/CommandHandlers/CountPayoutsCommandHandler.php
- Command line
-
hf download hf://pnacorp/AIKEEDO/src/Affiliate/Application/CommandHandlers/CountPayoutsCommandHandler.php
-
curl -L -o CountPayoutsCommandHandler.php https://huggingface.co/pnacorp/AIKEEDO/resolve/main/src/Affiliate/Application/CommandHandlers/CountPayoutsCommandHandler.php
664 Bytes
| declare(strict_types=1); | |
| namespace Affiliate\Application\CommandHandlers; | |
| use Affiliate\Application\Commands\CountPayoutsCommand; | |
| use Affiliate\Domain\Repositories\PayoutRepositoryInterface; | |
| class CountPayoutsCommandHandler | |
| { | |
| public function __construct( | |
| private PayoutRepositoryInterface $repo | |
| ) {} | |
| public function handle(CountPayoutsCommand $cmd): int | |
| { | |
| $payouts = $this->repo; | |
| if ($cmd->status) { | |
| $payouts = $payouts->filterByStatus($cmd->status); | |
| } | |
| if ($cmd->user) { | |
| $payouts = $payouts->filterByUser($cmd->user); | |
| } | |
| return $payouts->count(); | |
| } | |
| } | |