Completed
Push — master ( c5142e...c9d80b )
by Cheren
11:40
created

Application::bootstrap()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 5
rs 9.4285
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
/**
3
 * CakeCMS Core
4
 *
5
 * This file is part of the of the simple cms based on CakePHP 3.
6
 * For the full copyright and license information, please view the LICENSE
7
 * file that was distributed with this source code.
8
 *
9
 * @package     Core
10
 * @license     MIT
11
 * @copyright   MIT License http://www.opensource.org/licenses/mit-license.php
12
 * @link        https://github.com/CakeCMS/Core".
13
 * @author      Sergey Kalistratov <[email protected]>
14
 */
15
16
namespace Core;
17
18
use Cake\Http\BaseApplication;
19
use Cake\Routing\Middleware\AssetMiddleware;
20
use Cake\Routing\Middleware\RoutingMiddleware;
21
use Cake\Error\Middleware\ErrorHandlerMiddleware;
22
23
/**
24
 * Class Application
25
 *
26
 * @package App
27
 */
28
class Application extends BaseApplication
29
{
30
31
    /**
32
     * {@inheritDoc}
33
     */
34
    public function bootstrap()
35
    {
36
        // Call parent to load bootstrap from files.
37
        parent::bootstrap();
38
    }
39
40
    /**
41
     * Setup the middleware queue your application will use.
42
     *
43
     * @param \Cake\Http\MiddlewareQueue $middlewareQueue The middleware queue to setup.
44
     * @return \Cake\Http\MiddlewareQueue The updated middleware queue.
45
     */
46
    public function middleware($middlewareQueue)
47
    {
48
        $middlewareQueue
49
            // Catch any exceptions in the lower layers,
50
            // and make an error page/response
51
            ->add(ErrorHandlerMiddleware::class)
52
53
            // Handle plugin/theme assets like CakePHP normally does.
54
            ->add(AssetMiddleware::class)
55
56
            // Add routing middleware.
57
            // Routes collection cache enabled by default, to disable route caching
58
            // pass null as cacheConfig, example: `new RoutingMiddleware($this)`
0 ignored issues
show
Unused Code Comprehensibility introduced by
36% 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...
59
            // you might want to disable this cache in case your routing is extremely simple
60
            ->add(new RoutingMiddleware($this, '_cake_routes_'));
61
62
        return $middlewareQueue;
63
    }
64
}
65