Completed
Push — develop ( 4b49c4...89d32a )
by Jaap
09:06 queued 05:30
created

DebugEvent::setPriority()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 1
dl 0
loc 6
ccs 3
cts 3
cp 1
crap 1
rs 9.4285
c 0
b 0
f 0
1
<?php
2
/**
3
 * phpDocumentor
4
 *
5
 * PHP Version 5.3
6
 *
7
 * @copyright 2010-2014 Mike van Riel / Naenius (http://www.naenius.com)
8
 * @license   http://www.opensource.org/licenses/mit-license.php MIT
9
 * @link      http://phpdoc.org
10
 */
11
12
namespace phpDocumentor\Event;
13
14
use Psr\Log\LogLevel;
15
16
/**
17
 * Event representing some debugging information for phpDocumentor.
18
 *
19
 * The information logged by this event will only be visible if the verbose
20
 * option is provided to phpDocumentor.
21
 */
22
class DebugEvent extends EventAbstract
23
{
24
    /** @var string Message to display with the debugging event */
25
    protected $message;
26
27
    /** @var int Default priority level for these events is DEBUG */
28
    protected $priority = LogLevel::DEBUG;
29
30
    /** @var string[] Extra parameters to insert into the message after translation */
31
    protected $context = array();
32
33
    /**
34
     * Provides the message that is to be shown with this event.
35
     *
36
     * @param string $message
37
     *
38
     * @return DebugEvent
39
     */
40 1
    public function setMessage($message)
41
    {
42 1
        $this->message = $message;
43
44 1
        return $this;
45
    }
46
47
    /**
48
     * Returns the message that was provided with this event.
49
     *
50
     * @return string
51
     */
52 1
    public function getMessage()
53
    {
54 1
        return $this->message;
55
    }
56
57
    /**
58
     * Returns the priority level associated with this logging event.
59
     *
60
     * @return int
61
     */
62 3
    public function getPriority()
63
    {
64 3
        return $this->priority;
65
    }
66
67
    /**
68
     * Sets the priority level associated with this logging event.
69
     *
70
     * @param string $priority
71
     *
72
     * @return DebugEvent
73
     */
74 1
    public function setPriority($priority)
75
    {
76 1
        $this->priority = $priority;
0 ignored issues
show
Documentation Bug introduced by
The property $priority was declared of type integer, but $priority is of type string. Maybe add a type cast?

This check looks for assignments to scalar types that may be of the wrong type.

To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.

$answer = 42;

$correct = false;

$correct = (bool) $answer;
Loading history...
77
78 1
        return $this;
79
    }
80
81
    /**
82
     * Sets additional context (parameters) to use when translating messages.
83
     *
84
     * @param string[] $context
85
     *
86
     * @return self
87
     */
88 1
    public function setContext(array $context)
89
    {
90 1
        $this->context = $context;
91
92 1
        return $this;
93
    }
94
95
    /**
96
     * Returns the context for this event.
97
     *
98
     * @return string[]
99
     */
100 1
    public function getContext()
101
    {
102 1
        return $this->context;
103
    }
104
}
105