Completed
Pull Request — master (#12)
by
unknown
01:57
created

Logger   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 1
dl 0
loc 27
ccs 0
cts 15
cp 0
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A logException() 0 11 1
A syslog() 0 4 1
1
<?php
2
namespace Aoe\Asdis\System\Log;
3
4
use TYPO3\CMS\Core\Utility\GeneralUtility;
5
use TYPO3\CMS\Core\SingletonInterface;
6
7
/**
8
 * System logger.
9
 */
10
class Logger implements SingletonInterface
11
{
12
    /**
13
     * @param string $context
14
     * @param Exception $e
15
     */
16
    public function logException($context, \Exception $e)
17
    {
18
        $this->syslog(
19
            $context,
20
            'Exception occured ' . PHP_EOL .
21
            '  Code:    ' . $e->getCode() . PHP_EOL .
22
            '  Message: "' . $e->getMessage() . '"' . PHP_EOL .
23
            '  Trace:' . PHP_EOL . $e->getTraceAsString(),
24
            4
0 ignored issues
show
Unused Code introduced by
The call to Logger::syslog() has too many arguments starting with 4.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
25
        );
26
    }
27
28
    /**
29
     * @param string $message
30
     * @param integer $severity
31
     */
32
    private function syslog($message, $severity)
33
    {
34
        GeneralUtility::sysLog($message, 'asdis', $severity);
35
    }
36
}