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.
Passed
Push — master ( 68b159...b90f1e )
by Carsten
03:34 queued 14s
created

BrowserConsoleLoggerServiceProvider   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 57
Duplicated Lines 52.63 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 81.25%

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 2
dl 30
loc 57
ccs 13
cts 16
cp 0.8125
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 2
A register() 30 30 2

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
namespace Germania\Logger;
3
4
use Pimple\Container;
5
use Pimple\ServiceProviderInterface;
6
7
use Monolog\Logger;
8
use Monolog\Handler\BrowserConsoleHandler;
9
10
class BrowserConsoleLoggerServiceProvider implements ServiceProviderInterface
11
{
12
13
14
    /**
15
     * @var int
16
     */
17
    public $loglevel = Logger::INFO;
18
19
20
    /**
21
     * @param string   $incoming_webook_url [description]
0 ignored issues
show
Bug introduced by
There is no parameter named $incoming_webook_url. 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...
22
     * @param int|null $loglevel            [description]
23
     */
24 2
    public function __construct(int $loglevel = null)
25
    {
26 2
        if (!is_null($loglevel)) {
27 2
            $this->loglevel = $loglevel;
28
        }
29 2
    }
30
31
32
    /**
33
     * @param  Container $dic [description]
34
     * @return void
35
     */
36 2 View Code Duplication
    public function register(Container $dic)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
37
    {
38
39
40
        // Make sure there's a 'Monolog.Handlers' service
41 2
        if (!$dic->offsetExists('Monolog.Handlers')) :
42 2
            $dic['Monolog.Handlers'] = function ($dic) {
0 ignored issues
show
Unused Code introduced by
The parameter $dic is not used and could be removed.

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

Loading history...
43
                return array();
44
            };
45
        endif;
46
47
48
        /**
49
         * @return array
50
         */
51 2
        $dic->extend('Monolog.Handlers', function (array $handlers, $dic) {
52
            $handlers[] = $dic['Monolog.Handlers.BrowserConsoleHandler'];
53
            return $handlers;
54 2
        });
55
56
57
58
        /**
59
         * @return BrowserConsoleHandler
60
         */
61 2
        $dic['Monolog.Handlers.BrowserConsoleHandler'] = function ($dic) {
0 ignored issues
show
Unused Code introduced by
The parameter $dic is not used and could be removed.

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

Loading history...
62 2
            $th = new BrowserConsoleHandler($this->loglevel);
63 2
            return $th;
64
        };
65 2
    }
66
}
67