SplPriorityQueue   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
c 1
b 0
f 0
lcom 1
cbo 0
dl 0
loc 22
ccs 6
cts 6
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A insert() 0 7 2
1
<?php
2
/**
3
 * Purple - Run tasks on collections
4
 *
5
 * PHP version 5
6
 *
7
 * Copyright (C) 2016 Jake Johns
8
 *
9
 * This software may be modified and distributed under the terms
10
 * of the MIT license.  See the LICENSE file for details.
11
 *
12
 * @category  Queue
13
 * @package   Jnjxp\Purple
14
 * @author    Jake Johns <[email protected]>
15
 * @copyright 2016 Jake Johns
16
 * @license   http://jnj.mit-license.org/2016 MIT License
17
 * @link      https://github.com/jnjxp/jnjxp.purple
18
 */
19
20
namespace Jnjxp\Purple;
21
22
/**
23
 * SplPriorityQueue
24
 *
25
 * @category Queue
26
 * @package  Jnjxp\Purple
27
 * @author   Jake Johns <[email protected]>
28
 * @license  http://jnj.mit-license.org/ MIT License
29
 * @link     https://github.com/jnjxp/jnjxp.purple
30
 */
31
class SplPriorityQueue extends \SplPriorityQueue
32
{
33
    protected $order = PHP_INT_MAX;
34
35
    /**
36
     * Insert
37
     *
38
     * @param mixed $value    value
39
     * @param mixed $priority order priority
40
     *
41
     * @return mixed
42
     *
43
     * @access public
44
     */
45 4
    public function insert($value, $priority)
46
    {
47 4
        if (is_int($priority)) {
48 4
            $priority = array($priority, $this->order--);
49 4
        }
50 4
        parent::insert($value, $priority);
51 4
    }
52
}
53