Total Complexity | 5 |
Total Lines | 25 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
17 | class TargetLoader implements Middleware |
||
18 | { |
||
19 | private $repo; |
||
20 | |||
21 | public function __construct(TargetRepository $repo) |
||
24 | } |
||
25 | |||
26 | public function execute($command, callable $next) |
||
27 | { |
||
28 | if (empty($command->target)) { |
||
29 | $command->target = $this->findTarget($command); |
||
30 | } |
||
31 | |||
32 | return $next($command); |
||
33 | } |
||
34 | |||
35 | private function findTarget($command): ?Target |
||
42 | } |
||
43 | } |
||
44 |