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 ( 685370...276e3f )
by Andreas
01:52
created

ErrorServiceProvider   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 57
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 9

Test Coverage

Coverage 80%

Importance

Changes 0
Metric Value
wmc 5
lcom 0
cbo 9
dl 0
loc 57
ccs 28
cts 35
cp 0.8
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
B register() 0 51 5
1
<?php
2
/**
3
 * Starlit App.
4
 *
5
 * @copyright Copyright (c) 2016 Starweb AB
6
 * @license   BSD 3-Clause
7
 */
8
9
namespace Starlit\App\Provider;
10
11
use Starlit\App\BaseApp;
12
13
/**
14
 * @author Andreas Nilsson <http://github.com/jandreasn>
15
 */
16
class ErrorServiceProvider implements ServiceProviderInterface
17
{
18
    /**
19
     * @param BaseApp $app
20
     */
21 20
    public function register(BaseApp $app)
22
    {
23
        $app->set('errorLogger', function (BaseApp $app) {
24 20
            $logger = new \Monolog\Logger('errorLogger');
25
26 20
            $handler = new \Monolog\Handler\ErrorLogHandler();
27 20
            if (!$app->isCli()) {
28
                $handler->pushProcessor(new \Monolog\Processor\WebProcessor());
29
                $format = '%level_name%: %message% %extra.server%%extra.url%';
30
            } else {
31 20
                $format = '%level_name%: %message%';
32
            }
33 20
            $handler->setFormatter(new \Monolog\Formatter\LineFormatter($format, null, true));
34 20
            $logger->pushHandler($handler);
35
36 20
            return $logger;
37 20
        });
38
39
        $app->set('whoopsDebugErrorPageHandler', function (BaseApp $app) {
40 20
            $prettyPageHandler = new \Whoops\Handler\PrettyPageHandler();
41 20
            if ($app->getConfig()->has('editor')) {
42
                $prettyPageHandler->setEditor($app->getConfig()->get('editor'));
0 ignored issues
show
Documentation introduced by
$app->getConfig()->get('editor') is of type *, but the function expects a callable.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
43
            }
44
45 20
            return $prettyPageHandler;
46 20
        });
47
48
        $app->set('whoopsErrorHandler', function (BaseApp $app) {
49 20
            $plainTextHandler = new \Whoops\Handler\PlainTextHandler();
50 20
            $plainTextHandler->setLogger($app->get('errorLogger'));
51 20
            if (!$app->isCli()) {
52
                $plainTextHandler->loggerOnly(true);
53
            }
54
55 20
            return $plainTextHandler;
56 20
        });
57
58 20
        $app->set('whoops', function (BaseApp $app) {
59 20
            $whoops = new \Whoops\Run();
60
61 20
            if (ini_get('display_errors')) {
62 20
                $whoops->pushHandler($app->get('whoopsDebugErrorPageHandler'));
0 ignored issues
show
Documentation introduced by
$app->get('whoopsDebugErrorPageHandler') is of type *, but the function expects a callable.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
63 20
            }
64
65
            // Handles cli output and logging
66 20
            $whoops->pushHandler($app->get('whoopsErrorHandler'));
0 ignored issues
show
Documentation introduced by
$app->get('whoopsErrorHandler') is of type *, but the function expects a callable.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
67
68 20
            return $whoops;
69 20
        });
70 20
        $app->get('whoops')->register();
71 20
    }
72
}
73