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 ( 010784...210d89 )
by Carsten
08:21 queued 12s
created

TeamsLoggerServiceProvider   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 66
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 3
dl 0
loc 66
ccs 16
cts 16
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 8 2
A register() 0 33 2
1
<?php
2
namespace Germania\Logger;
3
4
use Pimple\Container;
5
use Pimple\ServiceProviderInterface;
6
7
use Monolog\Logger;
8
use Monolog\Formatter\HtmlFormatter;
9
10
class TeamsLoggerServiceProvider implements ServiceProviderInterface
11
{
12
13
    /**
14
     * @var string
15
     */
16
    public $incoming_webook_url;
17
18
    /**
19
     * @var int
20
     */
21
    public $loglevel = Logger::INFO;
22
23
24
    /**
25
     * @param string   $incoming_webook_url [description]
26
     * @param int|null $loglevel            [description]
27
     */
28 8
    public function __construct( string $incoming_webook_url, int $loglevel = null )
29
    {
30 8
        $this->incoming_webook_url = $incoming_webook_url;
31
32 8
        if (!is_null($loglevel)) {
33 8
            $this->loglevel = $loglevel;
34
        }
35 8
    }
36
37
38
    /**
39
     * @param  Container $dic [description]
40
     * @return void
41
     */
42 4
    public function register(Container $dic)
43
    {
44
45
46
        // Make sure there's a 'Monolog.Handlers' service
47 4
        if (!$dic->offsetExists( 'Monolog.Handlers')) :
48
            $dic['Monolog.Handlers'] = function($dic) { return array(); };
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...
49
        endif;
50
51
52
        /**
53
         * @return array
54
         */
55 1
        $dic->extend('Monolog.Handlers', function(array $handlers, $dic) {
56 4
            $handlers[] = $dic['Monolog.Handlers.TeamsHandler'];
57 4
            return $handlers;
58 4
        });
59
60
61
62
        /**
63
         * Send log messages to Microsoft Teams.
64
         *
65
         * @return SlackHandler
66
         */
67 1
        $dic['Monolog.Handlers.TeamsHandler'] = 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...
68 4
            $th = new HtmlFormattedTeamsLogHandler( $this->incoming_webook_url, $this->loglevel);
69 4
            $th->setFormatter( new HtmlFormatter );
70 4
            return $th;
71
        };
72
73
74 4
    }
75
}
76