Total Complexity | 6 |
Total Lines | 28 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
8 | trait Priority |
||
9 | { |
||
10 | private int $priority; |
||
11 | |||
12 | public function getPriority(): int |
||
15 | } |
||
16 | |||
17 | public function withPriority(int $priority): static |
||
18 | { |
||
19 | $instance = clone $this; |
||
20 | $instance->setPriority($priority); |
||
21 | return $instance; |
||
22 | } |
||
23 | |||
24 | protected function setPriority(int $priority): void |
||
25 | { |
||
26 | $this->priority = $priority; |
||
27 | } |
||
28 | |||
29 | public static function sortByPriority(array &$haystack): void |
||
36 | }); |
||
37 | } |
||
38 | } |
||
39 |