Logger_Syslog   A
last analyzed

Complexity

Total Complexity 10

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 19
c 0
b 0
f 0
dl 0
loc 28
rs 10
wmc 10

1 Method

Rating   Name   Duplication   Size   Complexity  
B log_error() 0 23 10
1
<?php
2
class Logger_Syslog {
3
4
    /**
5
     * @SuppressWarnings(PHPMD.UnusedFormalParameter)
6
     */
7
    public function log_error($errno, $errstr, $file, $line, $context) {
0 ignored issues
show
Unused Code introduced by
The parameter $context is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

7
    public function log_error($errno, $errstr, $file, $line, /** @scrutinizer ignore-unused */ $context) {

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
8
9
        switch ($errno) {
10
        case E_ERROR:
11
        case E_PARSE:
12
        case E_CORE_ERROR:
13
        case E_COMPILE_ERROR:
14
        case E_USER_ERROR:
15
            $priority = LOG_ERR;
16
            break;
17
        case E_WARNING:
18
        case E_CORE_WARNING:
19
        case E_COMPILE_WARNING:
20
        case E_USER_WARNING:
21
            $priority = LOG_WARNING;
22
            break;
23
        default:
24
            $priority = LOG_INFO;
25
        }
26
27
        $errname = Logger::$errornames[$errno]." ($errno)";
28
29
        syslog($priority, "[tt-rss] $errname ($file:$line) $errstr");
30
31
    }
32
33
}
34