Code Coverage
 
Lines
Branches
Paths
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
14 / 14
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
4 / 4
CRAP
100.00% covered (success)
100.00%
1 / 1
Issue
100.00% covered (success)
100.00%
14 / 14
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
4 / 4
4
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
 withPrefix
100.00% covered (success)
100.00%
6 / 6
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
 toArray
100.00% covered (success)
100.00%
6 / 6
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
 jsonSerialize
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
7use JsonSerializable;
8use Override;
9
10/** @api */
11final readonly class Issue implements JsonSerializable
12{
13    /**
14     * @param list<string|int> $path
15     * @param array<string, mixed> $params
16     */
17    public function __construct(
18        public array $path,
19        public string $code,
20        public string $message,
21        public array $params = [],
22    ) {}
23
24    /** @param list<string|int> $prefix */
25    public function withPrefix(array $prefix): self
26    {
27        return new self(
28            [...$prefix, ...$this->path],
29            $this->code,
30            $this->message,
31            $this->params,
32        );
33    }
34
35    /** @return array{path: list<string|int>, code: string, message: string, params: array<string, mixed>} */
36    public function toArray(): array
37    {
38        return [
39            'path' => $this->path,
40            'code' => $this->code,
41            'message' => $this->message,
42            'params' => $this->params,
43        ];
44    }
45
46    /** @return array{path: list<string|int>, code: string, message: string, params: array<string, mixed>} */
47    #[Override]
48    public function jsonSerialize(): array
49    {
50        return $this->toArray();
51    }
52}

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.

Issue->__construct
18        public array $path,
19        public string $code,
20        public string $message,
21        public array $params = [],
22    ) {}
Issue->jsonSerialize
50        return $this->toArray();
51    }
Issue->toArray
39            'path' => $this->path,
40            'code' => $this->code,
41            'message' => $this->message,
42            'params' => $this->params,
43        ];
44    }
Issue->withPrefix
25    public function withPrefix(array $prefix): self
26    {
27        return new self(
28            [...$prefix, ...$this->path],
29            $this->code,
30            $this->message,
31            $this->params,
32        );
33    }