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