Passed
Push — master ( b05304...84ccec )
by Harry
02:04
created

PriorityChangedEvent   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
eloc 9
dl 0
loc 31
ccs 7
cts 7
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getItem() 0 3 1
1
<?php
2
/**
3
 * This file is part of graze/parallel-process.
4
 *
5
 * Copyright © 2018 Nature Delivered Ltd. <https://www.graze.com>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 *
10
 * @license https://github.com/graze/parallel-process/blob/master/LICENSE.md
11
 * @link    https://github.com/graze/parallel-process
12
 */
13
14
namespace Graze\ParallelProcess\Event;
15
16
use Graze\ParallelProcess\PrioritisedInterface;
17
use Symfony\Component\EventDispatcher\Event;
18
19
class PriorityChangedEvent extends Event
20
{
21
    const CHANGED = 'priority.changed';
22
23
    /** @var PrioritisedInterface */
24
    private $item;
25
    /** @var float */
26
    private $priority;
27
    /** @var float|null */
28
    private $oldPriority;
29
30
    /**
31
     * RunEvent constructor.
32
     *
33
     * @param PrioritisedInterface $item
34
     * @param float                $priority
35
     * @param float|null           $oldPriority
36
     */
37 4
    public function __construct(PrioritisedInterface $item, $priority, $oldPriority = null)
38
    {
39 4
        $this->item = $item;
40 4
        $this->priority = $priority;
41 4
        $this->oldPriority = $oldPriority;
42 4
    }
43
44
    /**
45
     * @return PrioritisedInterface
46
     */
47 2
    public function getItem()
48
    {
49 2
        return $this->item;
50
    }
51
}
52