Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
5 / 5 |
|
100.00% |
3 / 3 |
CRAP | |
100.00% |
1 / 1 |
| ValTesterTrait | |
100.00% |
5 / 5 |
|
100.00% |
3 / 3 |
4 | |
100.00% |
1 / 1 |
| getValueTester | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| setValueTester | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| testValue | |
100.00% |
3 / 3 |
|
100.00% |
1 / 1 |
2 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace pvc\struct\types\value; |
| 4 | |
| 5 | |
| 6 | use pvc\interfaces\struct\types\value\ValTesterInterface; |
| 7 | |
| 8 | trait ValTesterTrait |
| 9 | { |
| 10 | public ValTesterInterface $valueTester; |
| 11 | |
| 12 | protected function getValueTester(): ?ValTesterInterface |
| 13 | { |
| 14 | return $this->valueTester ?? null; |
| 15 | } |
| 16 | |
| 17 | public function setValueTester(ValTesterInterface $valueTester): void |
| 18 | { |
| 19 | $this->valueTester = $valueTester; |
| 20 | } |
| 21 | |
| 22 | public function testValue($value): bool |
| 23 | { |
| 24 | $result = $this->getValueTester()?->testValue($value); |
| 25 | if ($result === null) return true; |
| 26 | return $result; |
| 27 | } |
| 28 | } |