GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( 50b203...ffab00 )
by Hong
03:12
created

HandlerAbstract::isHandlingLevel()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 8
rs 9.4285
cc 2
eloc 5
nc 2
nop 1
1
<?php
2
/**
3
 * Phossa Project
4
 *
5
 * PHP version 5.4
6
 *
7
 * @category  Library
8
 * @package   Phossa2\Logger
9
 * @copyright Copyright (c) 2016 phossa.com
10
 * @license   http://mit-license.org/ MIT License
11
 * @link      http://www.phossa.com/
12
 */
13
/*# declare(strict_types=1); */
14
15
namespace Phossa2\Logger\Handler;
16
17
use Phossa2\Shared\Base\ObjectAbstract;
18
use Phossa2\Logger\Entry\LogEntryInterface;
19
use Phossa2\Logger\Formatter\FormatterInterface;
20
use Phossa2\Logger\Formatter\FormatterAwareTrait;
21
22
/**
23
 * HandlerAbstract
24
 *
25
 * @package Phossa2\Logger
26
 * @author  Hong Zhang <[email protected]>
27
 * @see     ObjectAbstract
28
 * @see     HandlerInterface
29
 * @version 2.0.0
30
 * @since   2.0.0 added
31
 * @since   2.0.1 removed level param from constructor
32
 */
33
abstract class HandlerAbstract extends ObjectAbstract implements HandlerInterface
34
{
35
    use FormatterAwareTrait;
36
37
    /**
38
     * Stop log propagation after this handler ?
39
     *
40
     * @var    bool
41
     * @access protected
42
     */
43
    protected $stop;
44
45
    /**
46
     * Created with level handling
47
     *
48
     * @param  string $level
0 ignored issues
show
Bug introduced by
There is no parameter named $level. Was it maybe removed?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.

Consider the following example. The parameter $italy is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $island
 * @param array $italy
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was removed, but the annotation was not.

Loading history...
49
     * @param  FormatterInterface $formatter if any
50
     * @param  bool $stopPropagation if u want to
51
     * @access public
52
     * @since  2.0.1 removed level param
53
     */
54
    public function __construct(
55
        FormatterInterface $formatter = null,
56
        /*# bool */ $stopPropagation = false
57
    ) {
58
        $this->stop  = (bool) $stopPropagation;
59
        $this->setFormatter($formatter);
60
    }
61
62
    /**
63
     * {@inheritdoc}
64
     */
65
    public function __invoke(LogEntryInterface $logEntry)
66
    {
67
        if ($this->isHandling($logEntry)) {
68
            // format message with formatter
69
            call_user_func($this->getFormatter(), $logEntry);
70
71
            // write method of this handler
72
            $this->write($logEntry);
73
74
            // stop propagation if u want to
75
            if ($this->stop) {
76
                $logEntry->stopPropagation(true);
77
            }
78
        }
79
    }
80
81
    /**
82
     * Destructor
83
     *
84
     * @access public
85
     */
86
    public function __destruct()
87
    {
88
        $this->close();
89
    }
90
91
    /**
92
     * Write to handler's device
93
     *
94
     * @param  LogEntryInterface $logEntry
95
     * @access protected
96
     */
97
    abstract protected function write(LogEntryInterface $logEntry);
98
99
    /**
100
     * Is this handler handling this log ?
101
     *
102
     * To be overriden by child classes
103
     *
104
     * @param  LogEntryInterface $logEntry
105
     * @return bool
106
     * @access protected
107
     */
108
    protected function isHandling(LogEntryInterface $logEntry)/*# : bool */
109
    {
110
        return true;
111
    }
112
113
    /**
114
     * Close the handler, to be overriden by child classes
115
     *
116
     * @access protected
117
     */
118
    protected function close()
119
    {
120
    }
121
122
    /**
123
     * Get EOL char base on the platform WIN or UNIX
124
     *
125
     * @return string
126
     * @access protected
127
     */
128
    protected function getEol()/*# : string */
129
    {
130
        if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
131
            return "\r\n";
132
        } else {
133
            return "\n";
134
        }
135
    }
136
137
    /**
138
     * Test to see if in CLI mode
139
     *
140
     * @return bool
141
     * @access protected
142
     */
143
    protected function isCliMode()/*# : bool */
144
    {
145
        return 'cli' === php_sapi_name();
146
    }
147
}
148