Total Complexity | 4 |
Total Lines | 34 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
14 | class PQJobs extends SplPriorityQueue |
||
15 | { |
||
16 | /** |
||
17 | * PQJobs constructor. |
||
18 | */ |
||
19 | public function __construct() |
||
20 | { |
||
21 | $this->setExtractFlags(self::EXTR_DATA); |
||
22 | } |
||
23 | |||
24 | /** |
||
25 | * @param mixed $priority1 |
||
26 | * @param mixed $priority2 |
||
27 | * @return int |
||
28 | */ |
||
29 | public function compare($priority1, $priority2) : int |
||
30 | { |
||
31 | return $priority2 <=> $priority1; |
||
32 | } |
||
33 | |||
34 | /** |
||
35 | * @param Job $job |
||
36 | */ |
||
37 | public function enqueue(Job $job) : void |
||
38 | { |
||
39 | $this->insert($job, $job->priority()); |
||
40 | } |
||
41 | |||
42 | /** |
||
43 | * @return Job |
||
44 | */ |
||
45 | public function dequeue() : Job |
||
48 | } |
||
49 | } |
||
50 |