| Total Complexity | 8 |
| Total Lines | 67 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 15 | class EngineBuilder |
||
| 16 | { |
||
| 17 | /** |
||
| 18 | * @var FilterInterface |
||
| 19 | */ |
||
| 20 | private $filter; |
||
| 21 | |||
| 22 | /** |
||
| 23 | * @var RunnerInterface |
||
| 24 | */ |
||
| 25 | private $runner; |
||
| 26 | |||
| 27 | /** |
||
| 28 | * @var bool |
||
| 29 | */ |
||
| 30 | private $ignoreUnknownAnnotations = false; |
||
| 31 | |||
| 32 | public function __construct() |
||
| 35 | } |
||
| 36 | |||
| 37 | public function setIgnoreUnknownAnnotations($flag = true) |
||
| 40 | } |
||
| 41 | |||
| 42 | public function setFilter(FilterInterface $filter): self |
||
| 43 | { |
||
| 44 | $this->filter = $filter; |
||
| 45 | return $this; |
||
| 46 | } |
||
| 47 | |||
| 48 | public function setRunner(RunnerInterface $runner): self |
||
| 49 | { |
||
| 50 | $this->runner = $runner; |
||
| 51 | return $this; |
||
| 52 | } |
||
| 53 | |||
| 54 | public function buildEngine(): Engine |
||
| 55 | { |
||
| 56 | return new Engine( |
||
| 57 | new Parser, |
||
| 58 | new ExampleFactory( |
||
| 59 | new ExpectationFactory, |
||
| 60 | $this->getFilter(), |
||
| 61 | $this->ignoreUnknownAnnotations |
||
| 62 | ), |
||
| 63 | new ExampleTester( |
||
| 64 | $this->getRunner(), |
||
| 65 | new ExpectationEvaluator |
||
| 66 | ) |
||
| 67 | ); |
||
| 68 | } |
||
| 69 | |||
| 70 | private function getFilter(): FilterInterface |
||
| 71 | { |
||
| 72 | return $this->filter; |
||
| 73 | } |
||
| 74 | |||
| 75 | private function getRunner(): RunnerInterface |
||
| 82 | } |
||
| 83 | } |
||
| 84 |