Completed
Pull Request — master (#178)
by Fèvre
02:40
created

Application   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 6

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 6
dl 0
loc 24
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A middleware() 0 15 1
1
<?php
2
/**
3
 * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
4
 * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
5
 *
6
 * Licensed under The MIT License
7
 * For full copyright and license information, please see the LICENSE.txt
8
 * Redistributions of files must retain the above copyright notice.
9
 *
10
 * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
11
 * @link      http://cakephp.org CakePHP(tm) Project
12
 * @since     3.3.0
13
 * @license   http://www.opensource.org/licenses/mit-license.php MIT License
14
 */
15
namespace App;
16
17
use Cake\Core\Configure;
18
use Cake\Error\Middleware\ErrorHandlerMiddleware;
19
use Cake\Http\BaseApplication;
20
use Cake\Routing\Middleware\AssetMiddleware;
21
use Cake\Routing\Middleware\RoutingMiddleware;
22
23
/**
24
 * Application setup class.
25
 *
26
 * This defines the bootstrapping logic and middleware layers you
27
 * want to use in your application.
28
 */
29
class Application extends BaseApplication
30
{
31
    /**
32
     * Setup the middleware your application will use.
33
     *
34
     * @param \Cake\Http\MiddlewareQueue $middleware The middleware queue to setup.
35
     * @return \Cake\Http\MiddlewareQueue The updated middleware.
36
     */
37
    public function middleware($middleware)
38
    {
39
        $middleware
40
            // Catch any exceptions in the lower layers,
41
            // and make an error page/response
42
            ->add(new ErrorHandlerMiddleware(Configure::read('Error.exceptionRenderer')))
43
44
            // Handle plugin/theme assets like CakePHP normally does.
45
            ->add(new AssetMiddleware())
46
47
            // Apply routing
48
            ->add(new RoutingMiddleware());
49
50
        return $middleware;
51
    }
52
}
53