Plugin   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 49
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 8
dl 0
loc 49
rs 10
c 1
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A middleware() 0 5 1
A routes() 0 12 1
A bootstrap() 0 2 1
1
<?php
2
declare(strict_types=1);
3
4
namespace Sluggable;
5
6
use Cake\Core\BasePlugin;
7
use Cake\Core\PluginApplicationInterface;
8
use Cake\Http\MiddlewareQueue;
9
use Cake\Routing\RouteBuilder;
10
11
/**
12
 * Plugin for Sluggable
13
 */
14
class Plugin extends BasePlugin
15
{
16
    /**
17
     * Load all the plugin configuration and bootstrap logic.
18
     *
19
     * The host application is provided as an argument. This allows you to load
20
     * additional plugin dependencies, or attach events.
21
     *
22
     * @param \Cake\Core\PluginApplicationInterface $app The host application
23
     * @return void
24
     */
25
    public function bootstrap(PluginApplicationInterface $app): void
26
    {
27
    }
28
29
    /**
30
     * Add routes for the plugin.
31
     *
32
     * If your plugin has many routes and you would like to isolate them into a separate file,
33
     * you can create `$plugin/config/routes.php` and delete this method.
34
     *
35
     * @param \Cake\Routing\RouteBuilder $routes The route builder to update.
36
     * @return void
37
     */
38
    public function routes(RouteBuilder $routes): void
39
    {
40
        $routes->plugin(
41
            'Sluggable',
42
            ['path' => '/sluggable'],
43
            function (RouteBuilder $builder) {
44
                // Add custom routes here
45
46
                $builder->fallbacks();
47
            }
48
        );
49
        parent::routes($routes);
50
    }
51
52
    /**
53
     * Add middleware for the plugin.
54
     *
55
     * @param \Cake\Http\MiddlewareQueue $middlewareQueue The middleware queue to update.
56
     * @return \Cake\Http\MiddlewareQueue
57
     */
58
    public function middleware(MiddlewareQueue $middlewareQueue): MiddlewareQueue
59
    {
60
        // Add your middlewares here
61
62
        return $middlewareQueue;
63
    }
64
}
65