Code Coverage
 
Lines
Branches
Paths
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
7 / 7
100.00% covered (success)
100.00%
5 / 5
100.00% covered (success)
100.00%
4 / 4
CRAP
100.00% covered (success)
100.00%
1 / 1
Validation
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
7 / 7
100.00% covered (success)
100.00%
5 / 5
100.00% covered (success)
100.00%
4 / 4
5
100.00% covered (success)
100.00%
1 / 1
 __construct
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 valid
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 invalid
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 from
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
2
1<?php
2
3declare(strict_types=1);
4
5namespace Celemas\Sire;
6
7/** @api */
8final 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}

Branches

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.

Validation->__construct
11        public ?Failure $failure = null,
12    ) {}
Validation->from
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    }
Validation->invalid
19    public static function invalid(?Failure $failure = null): self
20    {
21        return new self($failure ?? Failure::invalid());
22    }
Validation->valid
16        return new self();
17    }