| Total Complexity | 14 |
| Total Lines | 53 |
| Duplicated Lines | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 10 | class SchemaBoolAttribute extends SchemaAttribute |
||
| 11 | { |
||
| 12 | protected array $positiveMatches; |
||
| 13 | protected array $negativeMatches; |
||
| 14 | |||
| 15 | public function __construct(Schema $schema, string $name) |
||
| 20 | } |
||
| 21 | |||
| 22 | public function positives(array $matches): self |
||
| 23 | { |
||
| 24 | $this->positiveMatches = $matches; |
||
| 25 | return $this; |
||
| 26 | } |
||
| 27 | |||
| 28 | public function negatives(array $matches): self |
||
| 32 | } |
||
| 33 | |||
| 34 | protected function isNegativeMatch($value): bool |
||
| 35 | { |
||
| 36 | return array_reduce($this->negativeMatches, fn($carry, $current) => $carry || $current == $value ? true : false, false); |
||
| 37 | } |
||
| 38 | |||
| 39 | protected function isPositiveMatch($value): bool |
||
| 40 | { |
||
| 41 | return array_reduce($this->positiveMatches, fn($carry, $current) => $carry || $current == $value ? true : false, false); |
||
| 42 | } |
||
| 43 | |||
| 44 | public function parseContextual($value) |
||
| 63 | } |
||
| 64 | } |