Signal::getPriority()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 4
Ratio 100 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 4
loc 4
ccs 0
cts 4
cp 0
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 2
1
<?php
2
3
namespace Thruster\Component\EventLoop;
4
5
/**
6
 * Class Signal
7
 *
8
 * @package Thruster\Component\EventLoop
9
 * @author  Aurimas Niekis <[email protected]>
10
 */
11 View Code Duplication
class Signal
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
12
{
13
    /**
14
     * @var EventLoop
15
     */
16
    protected $loop;
17
18
    /**
19
     * @var int
20
     */
21
    protected $signalNo;
22
23
    /**
24
     * @var callable
25
     */
26
    protected $callback;
27
28
    /**
29
     * @var int
30
     */
31
    protected $priority;
32
33
    public function __construct(
34
        EventLoop $loop,
35
        int $signalNo,
36
        callable $callback,
37
        int $priority = 0
38
    ) {
39
        $this->loop = $loop;
40
        $this->signalNo = $signalNo;
41
        $this->callback = $callback;
42
        $this->priority = $priority;
43
    }
44
45
    /**
46
     * @return EventLoop
47
     */
48
    public function getLoop()
49
    {
50
        return $this->loop;
51
    }
52
53
    /**
54
     * @return int
55
     */
56
    public function getSignalNo()
57
    {
58
        return $this->signalNo;
59
    }
60
61
    /**
62
     * @return callable
63
     */
64
    public function getCallback()
65
    {
66
        return $this->callback;
67
    }
68
69
    /**
70
     * @return int
71
     */
72
    public function getPriority()
73
    {
74
        return $this->priority;
75
    }
76
77
    public function cancel()
78
    {
79
        $this->loop->cancelSignal($this);
80
    }
81
}
82