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
01:39
created

StandardServiceProvider::register()   A

Complexity

Conditions 2
Paths 1

Size

Total Lines 36

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 19
CRAP Score 2.078

Importance

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