| Total Complexity | 5 |
| Total Lines | 46 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 9 | class FieldDoesNotExtendState extends InvalidConfig implements ProvidesSolution |
||
| 10 | { |
||
| 11 | /** @var string */ |
||
| 12 | protected $field; |
||
| 13 | |||
| 14 | /** @var string */ |
||
| 15 | protected $expectedStateClass; |
||
| 16 | |||
| 17 | /** @var string */ |
||
| 18 | protected $actualClass; |
||
| 19 | |||
| 20 | public static function make(string $field, string $expectedStateClass, string $actualClass): self |
||
| 21 | { |
||
| 22 | return (new static("State field `{$field}` expects state to be of type `{$expectedStateClass}`, instead got `{$actualClass}`")) |
||
| 23 | ->setField($field) |
||
| 24 | ->setExpectedStateClass($expectedStateClass) |
||
| 25 | ->setActualClass($actualClass); |
||
| 26 | } |
||
| 27 | |||
| 28 | public function setField(string $field): self |
||
| 33 | } |
||
| 34 | |||
| 35 | public function setExpectedStateClass(string $expectedStateClass): self |
||
| 36 | { |
||
| 37 | $this->expectedStateClass = $expectedStateClass; |
||
| 38 | |||
| 39 | return $this; |
||
| 40 | } |
||
| 41 | |||
| 42 | public function setActualClass(string $actualClass): self |
||
| 43 | { |
||
| 44 | $this->actualClass = $actualClass; |
||
| 45 | |||
| 46 | return $this; |
||
| 47 | } |
||
| 48 | |||
| 49 | public function getSolution(): Solution |
||
| 55 | ]); |
||
| 56 | } |
||
| 57 | } |
||
| 58 |