Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
84.62% |
11 / 13 |
|
80.00% |
4 / 5 |
CRAP | |
0.00% |
0 / 1 |
| AdminThemePlugin | |
84.62% |
11 / 13 |
|
80.00% |
4 / 5 |
5.09 | |
0.00% |
0 / 1 |
| bootstrap | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| routes | |
100.00% |
8 / 8 |
|
100.00% |
1 / 1 |
1 | |||
| middleware | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| console | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
2 | |||
| services | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | declare(strict_types=1); |
| 3 | |
| 4 | namespace AdminTheme; |
| 5 | |
| 6 | use Cake\Console\CommandCollection; |
| 7 | use Cake\Core\BasePlugin; |
| 8 | use Cake\Core\ContainerInterface; |
| 9 | use Cake\Core\PluginApplicationInterface; |
| 10 | use Cake\Http\MiddlewareQueue; |
| 11 | use Cake\Routing\RouteBuilder; |
| 12 | |
| 13 | /** |
| 14 | * Plugin for AdminTheme |
| 15 | */ |
| 16 | class AdminThemePlugin extends BasePlugin |
| 17 | { |
| 18 | /** |
| 19 | * Load all the plugin configuration and bootstrap logic. |
| 20 | * |
| 21 | * The host application is provided as an argument. This allows you to load |
| 22 | * additional plugin dependencies, or attach events. |
| 23 | * |
| 24 | * @param \Cake\Core\PluginApplicationInterface $app The host application |
| 25 | * @return void |
| 26 | */ |
| 27 | public function bootstrap(PluginApplicationInterface $app): void |
| 28 | { |
| 29 | } |
| 30 | |
| 31 | /** |
| 32 | * Add routes for the plugin. |
| 33 | * |
| 34 | * If your plugin has many routes and you would like to isolate them into a separate file, |
| 35 | * you can create `$plugin/config/routes.php` and delete this method. |
| 36 | * |
| 37 | * @param \Cake\Routing\RouteBuilder $routes The route builder to update. |
| 38 | * @return void |
| 39 | */ |
| 40 | public function routes(RouteBuilder $routes): void |
| 41 | { |
| 42 | $routes->plugin( |
| 43 | 'AdminTheme', |
| 44 | ['path' => '/admin-theme'], |
| 45 | function (RouteBuilder $builder) { |
| 46 | // Add custom routes here |
| 47 | |
| 48 | $builder->fallbacks(); |
| 49 | } |
| 50 | ); |
| 51 | parent::routes($routes); |
| 52 | } |
| 53 | |
| 54 | /** |
| 55 | * Add middleware for the plugin. |
| 56 | * |
| 57 | * @param \Cake\Http\MiddlewareQueue $middlewareQueue The middleware queue to update. |
| 58 | * @return \Cake\Http\MiddlewareQueue |
| 59 | */ |
| 60 | public function middleware(MiddlewareQueue $middlewareQueue): MiddlewareQueue |
| 61 | { |
| 62 | // Add your middlewares here |
| 63 | |
| 64 | return $middlewareQueue; |
| 65 | } |
| 66 | |
| 67 | /** |
| 68 | * Add commands for the plugin. |
| 69 | * |
| 70 | * @param \Cake\Console\CommandCollection $commands The command collection to update. |
| 71 | * @return \Cake\Console\CommandCollection |
| 72 | */ |
| 73 | public function console(CommandCollection $commands): CommandCollection |
| 74 | { |
| 75 | // Add your commands here |
| 76 | |
| 77 | $commands = parent::console($commands); |
| 78 | |
| 79 | return $commands; |
| 80 | } |
| 81 | |
| 82 | /** |
| 83 | * Register application container services. |
| 84 | * |
| 85 | * @param \Cake\Core\ContainerInterface $container The Container to update. |
| 86 | * @return void |
| 87 | * @link https://book.cakephp.org/4/en/development/dependency-injection.html#dependency-injection |
| 88 | */ |
| 89 | public function services(ContainerInterface $container): void |
| 90 | { |
| 91 | // Add your services here |
| 92 | } |
| 93 | } |