| Total Complexity | 5 |
| Total Lines | 36 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php declare(strict_types=1); |
||
| 18 | final class DepthFirstStrategy implements SearchStrategy |
||
| 19 | { |
||
| 20 | /** @var SplStack */ |
||
| 21 | private $stack; |
||
| 22 | /** @var Puzzle */ |
||
| 23 | private $originalPuzzle; |
||
| 24 | |||
| 25 | private function __construct( |
||
| 26 | SplStack $stack, |
||
| 27 | Puzzle $originalPuzzle |
||
| 28 | ) { |
||
| 29 | $this->stack = $stack; |
||
| 30 | $this->originalPuzzle = $originalPuzzle; |
||
| 31 | } |
||
| 32 | |||
| 33 | public static function forThe(Puzzle $puzzle): SearchStrategy |
||
| 38 | } |
||
| 39 | |||
| 40 | public function isOngoing(): bool |
||
| 41 | { |
||
| 42 | return !$this->stack->isEmpty(); |
||
| 43 | } |
||
| 44 | |||
| 45 | public function consider(Puzzle $puzzle): bool |
||
| 46 | { |
||
| 47 | $this->stack->push($puzzle->movesSoFar()); |
||
| 48 | return true; |
||
| 49 | } |
||
| 50 | |||
| 51 | public function nextCandidate(): Puzzle |
||
| 54 | } |
||
| 55 | } |
||
| 56 |