| Total Complexity | 5 |
| Total Lines | 45 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 17 | trait HasResolverPipelineTrait |
||
| 18 | { |
||
| 19 | /** |
||
| 20 | * @var Pipeline[] |
||
| 21 | */ |
||
| 22 | protected $resolverPipeline = []; |
||
| 23 | |||
| 24 | /** |
||
| 25 | * @param Command $command |
||
| 26 | * @return Command |
||
| 27 | * @throws ForwardException |
||
| 28 | */ |
||
| 29 | 3 | protected function processCommand(Command $command) |
|
| 30 | { |
||
| 31 | 3 | $pipeline = $this->getResolverPipeline(); |
|
| 32 | 3 | return $pipeline->process($command); |
|
| 33 | } |
||
| 34 | |||
| 35 | /** |
||
| 36 | * @param string $type |
||
| 37 | * @return Pipeline |
||
| 38 | */ |
||
| 39 | 4 | public function getResolverPipeline($type = ActionBuilder::class) |
|
| 40 | { |
||
| 41 | 4 | if (!isset($this->resolverPipeline[$type])) { |
|
| 42 | 4 | $this->initResolverPipeline($type); |
|
| 43 | } |
||
| 44 | 4 | return $this->resolverPipeline[$type]; |
|
| 45 | } |
||
| 46 | |||
| 47 | /** |
||
| 48 | * @param string $type |
||
| 49 | */ |
||
| 50 | 4 | protected function initResolverPipeline($type) |
|
| 51 | { |
||
| 52 | 4 | $this->resolverPipeline[$type] = $this->getResolverBuilder($type)->build(); |
|
| 53 | 4 | } |
|
| 54 | |||
| 55 | /** |
||
| 56 | * @param $type |
||
| 57 | * @return ActionBuilder |
||
| 58 | */ |
||
| 59 | 4 | protected function getResolverBuilder($type) |
|
| 62 | } |
||
| 63 | } |
||
| 64 |