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.

Application::getConfiguredProviders()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 19
Code Lines 16

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 16
nc 1
nop 0
dl 0
loc 19
ccs 0
cts 2
cp 0
crap 2
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
namespace Nip;
4
5
use Nip\Application\ApplicationInterface;
6
use Nip\Application\Bootstrap\CoreBootstrapersTrait;
7
use Nip\Application\Traits\BindPathsTrait;
8
use Nip\Application\Traits\EnviromentConfiguration;
9
use Nip\AutoLoader\AutoLoaderAwareTrait;
10
use Nip\AutoLoader\AutoLoaderServiceProvider;
11
use Nip\Container\ContainerAliasBindingsTrait;
12
use Nip\Container\ServiceProviders\ServiceProviderAwareTrait;
13
use Nip\Database\DatabaseServiceProvider;
14
use Nip\Dispatcher\DispatcherAwareTrait;
15
use Nip\Dispatcher\DispatcherServiceProvider;
16
use Nip\Filesystem\FilesystemServiceProvider;
17
use Nip\FlashData\FlashServiceProvider;
18
use Nip\Http\Response\Response;
19
use Nip\I18n\TranslatorServiceProvider;
20
use Nip\Inflector\InflectorServiceProvider;
21
use Nip\Locale\LocaleServiceProvider;
22
use Nip\Logger\LoggerServiceProvider;
23
use Nip\Mail\MailServiceProvider;
24
use Nip\Mvc\MvcServiceProvider;
25
use Nip\Router\RouterAwareTrait;
26
use Nip\Router\RouterServiceProvider;
27
use Nip\Router\RoutesServiceProvider;
28
use Nip\Staging\StagingAwareTrait;
29
use Nip\Staging\StagingServiceProvider;
30
use Symfony\Component\HttpKernel\Exception\HttpException;
31
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
32
33
/**
34
 * Class Application
35
 * @package Nip
36
 */
37
class Application implements ApplicationInterface
38
{
39
    use ContainerAliasBindingsTrait;
40
    use CoreBootstrapersTrait;
41
    use ServiceProviderAwareTrait;
42
    use BindPathsTrait;
43
    use EnviromentConfiguration;
44
    use AutoLoaderAwareTrait;
45
    use RouterAwareTrait;
46
    use DispatcherAwareTrait;
47
    use StagingAwareTrait;
48
49
    /**
50
     * The ByTIC framework version.
51
     *
52
     * @var string
53
     */
54
    const VERSION = '1.0.1';
55
56
    /**
57
     * Indicates if the application has "booted".
58
     *
59
     * @var bool
60
     */
61
    protected $booted = false;
62
63
    /**
64
     * @var null|Request
65
     */
66
    protected $request = null;
67
68
    /**
69
     * Create a new Illuminate application instance.
70
     *
71
     * @param  string|null $basePath
72
     *
73
     * @return void
0 ignored issues
show
Comprehensibility Best Practice introduced by
Adding a @return annotation to constructors is generally not recommended as a constructor does not have a meaningful return value.

Adding a @return annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.

Please refer to the PHP core documentation on constructors.

Loading history...
74
     */
75 1
    public function __construct($basePath = null)
76
    {
77 1
        if ($basePath) {
0 ignored issues
show
Bug Best Practice introduced by
The expression $basePath of type string|null is loosely compared to true; this is ambiguous if the string can be empty. You might want to explicitly use !== null instead.

In PHP, under loose comparison (like ==, or !=, or switch conditions), values of different types might be equal.

For string values, the empty string '' is a special case, in particular the following results might be unexpected:

''   == false // true
''   == null  // true
'ab' == false // false
'ab' == null  // false

// It is often better to use strict comparison
'' === false // false
'' === null  // false
Loading history...
78
            $this->setBasePath($basePath);
79
        }
80 1
    }
81
82
    public function setupAutoLoaderPaths()
83
    {
84
    }
85
86
    public function boot()
87
    {
88
        if ($this->isBooted()) {
89
            return;
90
        }
91
92
        $this->bootProviders();
93
        $this->booted = true;
94
    }
95
96
    /**
97
     * Determine if the application has booted.
98
     *
99
     * @return bool
100
     */
101 1
    public function isBooted()
102
    {
103 1
        return $this->booted;
104
    }
105
106
    /** @noinspection PhpUnusedParameterInspection
107
     *
108
     * @param Request $request
109
     * @param Response $response
110
     * @return Response
111
     */
112
    public function filterResponse(Response $response, Request $request)
0 ignored issues
show
Unused Code introduced by
The parameter $request is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
113
    {
114
        return $response;
115
    }
116
117
    public function terminate()
118
    {
119
    }
120
121
    /**
122
     * @return array
123
     */
124
    public function getConfiguredProviders()
125
    {
126
        return [
127
            AutoLoaderServiceProvider::class,
128
            LoggerServiceProvider::class,
129
            InflectorServiceProvider::class,
130
            LocaleServiceProvider::class,
131
            MailServiceProvider::class,
132
            MvcServiceProvider::class,
133
            DispatcherServiceProvider::class,
134
            StagingServiceProvider::class,
135
            RouterServiceProvider::class,
136
            RoutesServiceProvider::class,
137
            DatabaseServiceProvider::class,
138
            TranslatorServiceProvider::class,
139
            FlashServiceProvider::class,
140
            FilesystemServiceProvider::class,
141
        ];
142
    }
143
144
    /**
145
     * Determine if the application configuration is cached.
146
     *
147
     * @return bool
148
     */
149
    public function configurationIsCached()
150
    {
151
        return false;
152
//        return file_exists($this->getCachedConfigPath());
0 ignored issues
show
Unused Code Comprehensibility introduced by
67% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
153
    }
154
155
    /**
156
     * Throw an HttpException with the given data.
157
     *
158
     * @param  int $code
159
     * @param  string $message
160
     * @param  array $headers
161
     * @return void
162
     *
163
     * @throws HttpException
164
     */
165
    public function abort($code, $message = '', array $headers = [])
166
    {
167
        if ($code == 404) {
168
            throw new NotFoundHttpException($message);
169
        }
170
        throw new HttpException($code, $message, null, $headers);
171
    }
172
173
    /**
174
     * @return string
175
     */
176 4
    public function getRootNamespace()
177
    {
178 4
        return 'App\\';
179
    }
180
181
    /**
182
     * @param Request $request
183
     * @return Response
184
     */
185
    protected function getResponseFromRequest($request)
186
    {
187
        if ($request->hasMCA()) {
188
            $response = $this->dispatchRequest($request);
189
            ob_get_clean();
190
191
            return $response;
192
        }
193
194
        throw new NotFoundHttpException('No MCA in Request');
195
    }
196
}
197