Total Complexity | 6 |
Total Lines | 57 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
5 | class Context implements ContextInterface |
||
6 | { |
||
7 | /** |
||
8 | * @var string[] |
||
9 | */ |
||
10 | private $path = []; |
||
11 | /** |
||
12 | * @var bool |
||
13 | */ |
||
14 | private $preserveUnknownParameters = false; |
||
15 | |||
16 | /** |
||
17 | * @return string[] |
||
18 | */ |
||
19 | public function getPath(): array |
||
20 | { |
||
21 | return $this->path; |
||
22 | } |
||
23 | |||
24 | /** |
||
25 | * @param string[] $path |
||
26 | * @return $this |
||
27 | */ |
||
28 | public function setPath(array $path): Context |
||
29 | { |
||
30 | $this->path = $path; |
||
31 | return $this; |
||
32 | } |
||
33 | |||
34 | public function withAppendedPath(string ...$segments): Context |
||
35 | { |
||
36 | return static::from($this)->setPath(array_merge($this->path, $segments)); |
||
37 | } |
||
38 | |||
39 | /** |
||
40 | * @return bool |
||
41 | */ |
||
42 | public function shouldPreserveUnknownParameters(): bool |
||
43 | { |
||
44 | return $this->preserveUnknownParameters; |
||
45 | } |
||
46 | |||
47 | /** |
||
48 | * @param bool $preserveUnknownParameters |
||
49 | * @return $this |
||
50 | */ |
||
51 | public function setPreserveUnknownParameters(bool $preserveUnknownParameters): Context |
||
55 | } |
||
56 | |||
57 | public static function from(ContextInterface $context): Context |
||
62 | } |
||
63 | } |
||
64 |