Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
4 / 4 |
|
100.00% |
4 / 4 |
CRAP | |
100.00% |
1 / 1 |
| ParserTester | |
100.00% |
4 / 4 |
|
100.00% |
4 / 4 |
4 | |
100.00% |
1 / 1 |
| __construct | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| testValue | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getParser | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| setParser | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * @author: Doug Wilbourne (dougwilbourne@gmail.com) |
| 5 | */ |
| 6 | declare(strict_types=1); |
| 7 | |
| 8 | namespace pvc\validator\val_tester\parser; |
| 9 | |
| 10 | use pvc\interfaces\parser\ParserInterface; |
| 11 | use pvc\interfaces\validator\valtesters\ValTesterParserInterface; |
| 12 | |
| 13 | /** |
| 14 | * Class ParserTester |
| 15 | */ |
| 16 | class ParserTester implements ValTesterParserInterface |
| 17 | { |
| 18 | /** |
| 19 | * @var ParserInterface |
| 20 | */ |
| 21 | protected ParserInterface $parser; |
| 22 | |
| 23 | public function __construct(ParserInterface $parser) |
| 24 | { |
| 25 | $this->setParser($parser); |
| 26 | } |
| 27 | |
| 28 | /** |
| 29 | * testValue |
| 30 | * @param string $value |
| 31 | * @return bool |
| 32 | */ |
| 33 | public function testValue(mixed $value): bool |
| 34 | { |
| 35 | return $this->getParser()->parse($value); |
| 36 | } |
| 37 | |
| 38 | /** |
| 39 | * getParser |
| 40 | * @return ParserInterface |
| 41 | */ |
| 42 | public function getParser(): ParserInterface |
| 43 | { |
| 44 | return $this->parser; |
| 45 | } |
| 46 | |
| 47 | /** |
| 48 | * setParser |
| 49 | * @param ParserInterface $parser |
| 50 | */ |
| 51 | public function setParser(ParserInterface $parser): void |
| 52 | { |
| 53 | $this->parser = $parser; |
| 54 | } |
| 55 | } |