| Total Complexity | 5 |
| Total Lines | 26 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 0 | ||
| 1 | <?php |
||
| 9 | abstract class AbstractStrategy implements StrategyInterface |
||
| 10 | { |
||
| 11 | protected $steps; |
||
| 12 | |||
| 13 | 2 | public function __construct(array $steps) |
|
| 14 | { |
||
| 15 | 2 | $this->steps = new \SplQueue(); |
|
| 16 | 2 | foreach ($steps as $step) { |
|
| 17 | 2 | $this->addStep($step); |
|
| 18 | } |
||
| 19 | 2 | } |
|
| 20 | |||
| 21 | 2 | public function getNextStep(): ?StepInterface |
|
| 22 | { |
||
| 23 | 2 | if ($this->steps->count() == 0) { |
|
| 24 | 1 | return null; |
|
| 25 | } |
||
| 26 | |||
| 27 | 2 | return $this->steps->dequeue(); |
|
| 28 | } |
||
| 29 | |||
| 30 | 2 | public function addStep(StepInterface $step): StrategyInterface |
|
| 35 | } |
||
| 36 | } |