Code Coverage
 
Lines
Branches
Paths
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
5 / 5
100.00% covered (success)
100.00%
7 / 7
66.67% covered (warning)
66.67%
4 / 6
100.00% covered (success)
100.00%
4 / 4
CRAP
100.00% covered (success)
100.00%
1 / 1
ErrorBag
100.00% covered (success)
100.00%
5 / 5
100.00% covered (success)
100.00%
7 / 7
66.67% covered (warning)
66.67%
4 / 6
100.00% covered (success)
100.00%
4 / 4
5.93
100.00% covered (success)
100.00%
1 / 1
 add
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
 addNested
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
4 / 4
33.33% covered (danger)
33.33%
1 / 3
100.00% covered (success)
100.00%
1 / 1
3.19
 hasErrors
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
 issues
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
1<?php
2
3declare(strict_types=1);
4
5namespace Celemas\Sire;
6
7/** @internal */
8final class ErrorBag
9{
10    /** @var list<Issue> */
11    private array $issues = [];
12
13    /** @param list<string|int> $path */
14    public function add(array $path, Issue $issue): void
15    {
16        $this->issues[] = $issue->withPrefix($path);
17    }
18
19    /** @param list<string|int> $path */
20    public function addNested(array $path, Result $result): void
21    {
22        foreach ($result->issues() as $issue) {
23            $this->add($path, $issue);
24        }
25    }
26
27    public function hasErrors(): bool
28    {
29        return $this->issues !== [];
30    }
31
32    /** @return list<Issue> */
33    public function issues(): array
34    {
35        return $this->issues;
36    }
37}

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.

ErrorBag->add
14    public function add(array $path, Issue $issue): void
15    {
16        $this->issues[] = $issue->withPrefix($path);
17    }
ErrorBag->addNested
20    public function addNested(array $path, Result $result): void
21    {
22        foreach ($result->issues() as $issue) {
22        foreach ($result->issues() as $issue) {
22        foreach ($result->issues() as $issue) {
23            $this->add($path, $issue);
22        foreach ($result->issues() as $issue) {
23            $this->add($path, $issue);
24        }
25    }
ErrorBag->hasErrors
29        return $this->issues !== [];
30    }
ErrorBag->issues
35        return $this->issues;
36    }