Total Complexity | 9 |
Total Lines | 89 |
Duplicated Lines | 0 % |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
13 | class Options implements OptionsInterface, \JsonSerializable |
||
14 | { |
||
15 | /** |
||
16 | * @var OptionsInterface |
||
17 | */ |
||
18 | private OptionsInterface $base; |
||
19 | |||
20 | /** |
||
21 | * Options constructor |
||
22 | */ |
||
23 | public function __construct() |
||
24 | { |
||
25 | $this->base = new RoadRunnerOptions(); |
||
26 | } |
||
27 | |||
28 | /** |
||
29 | * @var string|null |
||
30 | */ |
||
31 | private ?string $pipeline = null; |
||
32 | |||
33 | /** |
||
34 | * {@inheritDoc} |
||
35 | */ |
||
36 | public function getDelay(): int |
||
37 | { |
||
38 | return $this->base->getDelay(); |
||
39 | } |
||
40 | |||
41 | /** |
||
42 | * @param int|null $delay |
||
43 | * @return $this |
||
44 | */ |
||
45 | public function withDelay(?int $delay): self |
||
51 | } |
||
52 | |||
53 | /** |
||
54 | * {@inheritDoc} |
||
55 | */ |
||
56 | public function getPriority(): int |
||
57 | { |
||
58 | return $this->base->getPriority(); |
||
59 | } |
||
60 | |||
61 | /** |
||
62 | * @return string|null |
||
63 | */ |
||
64 | public function getPipeline(): ?string |
||
65 | { |
||
66 | return $this->pipeline; |
||
67 | } |
||
68 | |||
69 | /** |
||
70 | * @param string|null $pipeline |
||
71 | * @return self |
||
72 | */ |
||
73 | public function withPipeline(?string $pipeline): self |
||
74 | { |
||
75 | $options = clone $this; |
||
76 | $options->pipeline = $pipeline; |
||
77 | |||
78 | return $options; |
||
79 | } |
||
80 | |||
81 | /** |
||
82 | * @return array |
||
83 | */ |
||
84 | public function jsonSerialize(): array |
||
89 | ]; |
||
90 | } |
||
91 | |||
92 | /** |
||
93 | * @param positive-int|0 $delay |
||
94 | * @return Options |
||
95 | */ |
||
96 | public static function delayed(int $delay): self |
||
102 | } |
||
103 | } |
||
104 |