Conditions | 4 |
Paths | 1 |
Total Lines | 15 |
Lines | 0 |
Ratio | 0 % |
Tests | 10 |
CRAP Score | 4 |
Changes | 0 |
1 | <?php |
||
17 | 8 | public function insert(PipeInterface $handler, int $priority = 0): void |
|
18 | { |
||
19 | 8 | $this->queue[] = [ |
|
20 | 8 | 'item' => $handler, |
|
21 | 8 | 'p' => $priority, |
|
22 | 8 | '_p' => $this->queueOrder--, |
|
23 | ]; |
||
24 | usort($this->queue, function ($itemA, $itemB) { |
||
25 | 8 | if ($itemA['p'] == $itemB['p']) { |
|
26 | 5 | return ($itemA['_p'] > $itemB['_p']) ? -1 : 1; |
|
27 | } |
||
28 | |||
29 | 3 | return ($itemA['p'] > $itemB['p']) ? -1 : 1; |
|
30 | 8 | }); |
|
31 | 8 | } |
|
32 | |||
53 |