| Conditions | 3 |
| Paths | 3 |
| Total Lines | 16 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 13 |
| CRAP Score | 3 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 21 | 9 | public function with(TaskDecorator $decorator): void |
|
| 22 | { |
||
| 23 | 9 | foreach ($this->deployer->tasks as $taskName => $task) { |
|
| 24 | 9 | $beforeName = $taskName . '.' . $decorator->name() . '.before'; |
|
| 25 | 9 | $afterName = $taskName . '.' . $decorator->name() . '.after'; |
|
| 26 | 9 | $this->deployer->tasks->set( |
|
| 27 | 9 | $beforeName, |
|
| 28 | 9 | (new Task($beforeName, $decorator->callbackBefore($taskName)))->shallow() |
|
| 29 | ); |
||
| 30 | 9 | $this->deployer->tasks->set( |
|
| 31 | 9 | $afterName, |
|
| 32 | 9 | (new Task($afterName, $decorator->callbackAfter($taskName)))->shallow() |
|
| 33 | ); |
||
| 34 | 9 | if (!in_array($task->getName(), [$beforeName, $afterName], true)) { |
|
| 35 | 9 | $task->addBefore($beforeName); |
|
| 36 | 9 | $task->addAfter($afterName); |
|
| 37 | } |
||
| 41 |