Total Complexity | 5 |
Total Lines | 23 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
8 | trait Priority |
||
9 | { |
||
10 | protected int $priority = 0; |
||
11 | |||
12 | public function getPriority(): int |
||
13 | { |
||
14 | return $this->priority; |
||
15 | } |
||
16 | |||
17 | public function setPriority(int $priority): static |
||
18 | { |
||
19 | $instance = clone $this; |
||
20 | $instance->priority = $priority; |
||
21 | return $instance; |
||
22 | } |
||
23 | |||
24 | public static function sortByPriority(array &$haystack): void |
||
31 | }); |
||
32 | } |
||
33 | } |
||
34 |