Logger   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 1
Metric Value
wmc 1
c 2
b 0
f 1
dl 0
loc 19
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 10 1
1
<?php
2
namespace SimpleLogger\Utils;
3
4
use SimpleLogger\Configuration;
5
use SimpleLogger\SimpleLogger;
6
use Psr\Log\LogLevel;
7
8
class Logger extends SimpleLogger
9
{
10
11
    /**
12
     * Constructor.
13
     *
14
     * @param   string $logfile
15
     * @return  object
16
     */
17
    public function __construct($logfile)
18
    {
19
        $configuration = new Configuration();
20
        $configuration
21
            ->setLogFile($logfile)
22
            ->setVerbosity(LogLevel::NOTICE)
23
            ->setConsoleVerbosity(LogLevel::INFO)
24
            ->setLoggerConsoleFormat("%t %l %c:%f %m")
25
            ->setLoggerFileFormat("%t %l %c:%f %p %m");
26
        return parent::__construct($configuration);
0 ignored issues
show
Bug introduced by
Are you sure the usage of parent::__construct($configuration) targeting SimpleLogger\SimpleLogger::__construct() seems to always return null.

This check looks for function or method calls that always return null and whose return value is used.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
if ($a->getObject()) {

The method getObject() can return nothing but null, so it makes no sense to use the return value.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
Bug Best Practice introduced by
The expression return parent::__construct($configuration) returns the type void which is incompatible with the documented return type object.
Loading history...
27
    }
28
}
29