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 ( 2b8c74...685370 )
by Andreas
03:07
created

StandardServiceProvider::register()   B

Complexity

Conditions 2
Paths 1

Size

Total Lines 34
Code Lines 19

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 13
CRAP Score 2.0014

Importance

Changes 0
Metric Value
dl 0
loc 34
ccs 13
cts 14
cp 0.9286
rs 8.8571
c 0
b 0
f 0
cc 2
eloc 19
nc 1
nop 1
crap 2.0014
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 StandardServiceProvider implements ServiceProviderInterface
17
{
18
    /**
19
     * @param BaseApp $app
20
     */
21 18
    public function register(BaseApp $app)
22
    {
23
        $app->set('sessionStorage', function (BaseApp $app) {
24 1
            if ($app->isCli()) {
25 1
                return new \Symfony\Component\HttpFoundation\Session\Storage\MockArraySessionStorage();
26
            } else {
27
                return new \Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage();
28
            }
29 18
        });
30
31
        $app->set('session', function (BaseApp $app) {
32 1
            return new \Symfony\Component\HttpFoundation\Session\Session($app->getNew('sessionStorage'));
33 18
        });
34
35
        $app->set('router', function (BaseApp $app) {
36 1
            return new \Starlit\App\Router($app, $app->getConfig()->get('router', []));
37 18
        });
38
39
        $app->set('view', function (BaseApp $app) {
40 3
            return new \Starlit\App\View($app->getConfig()->get('view', []));
41 18
        });
42
43
        // Default response (force no cache)
44 18
        $app->set('response', function () {
45
            $response = new \Symfony\Component\HttpFoundation\Response();
46
47
            $response->headers->addCacheControlDirective('no-cache', true);
48
            $response->headers->addCacheControlDirective('max-age', 0);
49
            $response->headers->addCacheControlDirective('must-revalidate', true);
50
            $response->headers->addCacheControlDirective('no-store', true);
51
52
            return $response;
53 18
        });
54 18
    }
55
}
56