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
Pull Request — master (#1)
by
unknown
03:42
created

StandardServiceProvider::register()   A

Complexity

Conditions 2
Paths 1

Size

Total Lines 34

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 15
CRAP Score 2.1288

Importance

Changes 0
Metric Value
dl 0
loc 34
ccs 15
cts 22
cp 0.6818
rs 9.376
c 0
b 0
f 0
cc 2
nc 1
nop 1
crap 2.1288
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
    public function register(BaseApp $app)
22
    {
23 21
        $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 21
        });
30
31 21
        $app->set('session', function (BaseApp $app) {
32 1
            return new \Symfony\Component\HttpFoundation\Session\Session($app->getNew('sessionStorage'));
33 21
        });
34
35 21
        $app->set('router', function (BaseApp $app) {
36 1
            return new \Starlit\App\Router($app, $app->getConfig()->get('router', []));
37 21
        });
38
39 21
        $app->set('view', function (BaseApp $app) {
40 3
            return new \Starlit\App\View($app->getConfig()->get('view', []));
41 21
        });
42
43
        // Default response (force no cache)
44 21
        $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 21
        });
54
    }
55
}
56