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 (#3)
by
unknown
03:52 queued 01:03
created

StandardServiceProvider::register()   A

Complexity

Conditions 2
Paths 1

Size

Total Lines 35

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 18
CRAP Score 2.0878

Importance

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