Code Coverage |
||||||||||||||||
Lines |
Branches |
Paths |
Functions and Methods |
Classes and Traits |
||||||||||||
| Total | |
100.00% |
4 / 4 |
|
100.00% |
7 / 7 |
|
100.00% |
5 / 5 |
|
100.00% |
4 / 4 |
CRAP | |
100.00% |
1 / 1 |
| Validation | |
100.00% |
4 / 4 |
|
100.00% |
7 / 7 |
|
100.00% |
5 / 5 |
|
100.00% |
4 / 4 |
5 | |
100.00% |
1 / 1 |
| __construct | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| valid | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| invalid | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| from | |
100.00% |
1 / 1 |
|
100.00% |
4 / 4 |
|
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
2 | |||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace Celemas\Sire; |
| 6 | |
| 7 | /** @api */ |
| 8 | final readonly class Validation implements Contract\Validation |
| 9 | { |
| 10 | public function __construct( |
| 11 | public ?Failure $failure = null, |
| 12 | ) {} |
| 13 | |
| 14 | public static function valid(): self |
| 15 | { |
| 16 | return new self(); |
| 17 | } |
| 18 | |
| 19 | public static function invalid(?Failure $failure = null): self |
| 20 | { |
| 21 | return new self($failure ?? Failure::invalid()); |
| 22 | } |
| 23 | |
| 24 | public static function from(bool $valid, ?Failure $failure = null): self |
| 25 | { |
| 26 | return $valid ? self::valid() : self::invalid($failure); |
| 27 | } |
| 28 | } |
Below are the source code lines that represent each code branch as identified by Xdebug. Please note a branch is not
necessarily coterminous with a line, a line may contain multiple branches and therefore show up more than once.
Please also be aware that some branches may be implicit rather than explicit, e.g. an if statement
always has an else as part of its logical flow even if you didn't write one.
| 11 | public ?Failure $failure = null, |
| 12 | ) {} |
| 24 | public static function from(bool $valid, ?Failure $failure = null): self |
| 25 | { |
| 26 | return $valid ? self::valid() : self::invalid($failure); |
| 26 | return $valid ? self::valid() : self::invalid($failure); |
| 26 | return $valid ? self::valid() : self::invalid($failure); |
| 26 | return $valid ? self::valid() : self::invalid($failure); |
| 27 | } |
| 19 | public static function invalid(?Failure $failure = null): self |
| 20 | { |
| 21 | return new self($failure ?? Failure::invalid()); |
| 22 | } |
| 16 | return new self(); |
| 17 | } |