Passed
Push — master ( 12a6ad...9d8949 )
by Peter
02:44
created

admin-routes.php (4 issues)

Labels
Severity
1
<?php
2
3
declare(strict_types=1);
4
5
use AbterPhp\Admin\Config\Routes as RoutesConfig;
0 ignored issues
show
The type AbterPhp\Admin\Config\Routes was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
6
use AbterPhp\Admin\Http\Middleware\Authentication;
0 ignored issues
show
The type AbterPhp\Admin\Http\Middleware\Authentication was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
7
use AbterPhp\Admin\Http\Middleware\Authorization;
0 ignored issues
show
The type AbterPhp\Admin\Http\Middleware\Authorization was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
8
use AbterPhp\Admin\Http\Middleware\LastGridPage;
0 ignored issues
show
The type AbterPhp\Admin\Http\Middleware\LastGridPage was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
9
use AbterPhp\Framework\Authorization\Constant\Role;
10
use AbterPhp\Website\Constant\Routes as RoutesConstant;
11
use Opulence\Routing\Router;
12
13
/**
14
 * ----------------------------------------------------------
15
 * Create all of the routes for the HTTP kernel
16
 * ----------------------------------------------------------
17
 *
18
 * @var Router $router
19
 */
20
$router->group(
21
    ['controllerNamespace' => 'AbterPhp\Website\Http\Controllers'],
22
    function (Router $router) {
23
        $router->group(
24
            [
25
                'path'       => RoutesConfig::getAdminBasePath(),
26
                'middleware' => [
27
                    Authentication::class,
28
                ],
29
            ],
30
            function (Router $router) {
31
                $entities = [
32
                    'blocks'          => 'Block',
33
                    'block-layouts'   => 'BlockLayout',
34
                    'lists'           => 'ContentList',
35
                    'pages'           => 'Page',
36
                    'page-layouts'    => 'PageLayout',
37
                    'page-categories' => 'PageCategory',
38
                ];
39
40
                foreach ($entities as $route => $controllerName) {
41
                    /** @see \AbterPhp\Website\Http\Controllers\Admin\Grid\Block::show() */
42
                    /** @see \AbterPhp\Website\Http\Controllers\Admin\Grid\BlockLayout::show() */
43
                    /** @see \AbterPhp\Website\Http\Controllers\Admin\Grid\ContentList::show() */
44
                    /** @see \AbterPhp\Website\Http\Controllers\Admin\Grid\Page::show() */
45
                    /** @see \AbterPhp\Website\Http\Controllers\Admin\Grid\PageLayout::show() */
46
                    /** @see \AbterPhp\Website\Http\Controllers\Admin\Grid\PageCategory::show() */
47
                    $router->get(
48
                        "/${route}",
49
                        "Admin\Grid\\${controllerName}@show",
50
                        [
51
                            RoutesConstant::OPTION_NAME       => "${route}",
52
                            RoutesConstant::OPTION_MIDDLEWARE => [
53
                                Authorization::withParameters(
54
                                    [
55
                                        Authorization::RESOURCE => $route,
56
                                        Authorization::ROLE     => Role::READ,
57
                                    ]
58
                                ),
59
                                LastGridPage::class,
60
                            ],
61
                        ]
62
                    );
63
64
                    /** @see \AbterPhp\Website\Http\Controllers\Admin\Form\Block::new() */
65
                    /** @see \AbterPhp\Website\Http\Controllers\Admin\Form\BlockLayout::new() */
66
                    /** @see \AbterPhp\Website\Http\Controllers\Admin\Form\ContentList::new() */
67
                    /** @see \AbterPhp\Website\Http\Controllers\Admin\Form\Page::new() */
68
                    /** @see \AbterPhp\Website\Http\Controllers\Admin\Form\PageLayout::new() */
69
                    /** @see \AbterPhp\Website\Http\Controllers\Admin\Form\PageCategory::new() */
70
                    $router->get(
71
                        "/${route}/new",
72
                        "Admin\Form\\${controllerName}@new",
73
                        [
74
                            RoutesConstant::OPTION_NAME       => "${route}-new",
75
                            RoutesConstant::OPTION_MIDDLEWARE => [
76
                                Authorization::withParameters(
77
                                    [
78
                                        Authorization::RESOURCE => $route,
79
                                        Authorization::ROLE     => Role::WRITE,
80
                                    ]
81
                                ),
82
                            ],
83
                        ]
84
                    );
85
86
                    /** @see \AbterPhp\Website\Http\Controllers\Admin\Form\Block::create() */
87
                    /** @see \AbterPhp\Website\Http\Controllers\Admin\Form\BlockLayout::create() */
88
                    /** @see \AbterPhp\Website\Http\Controllers\Admin\Form\ContentList::create() */
89
                    /** @see \AbterPhp\Website\Http\Controllers\Admin\Form\Page::create() */
90
                    /** @see \AbterPhp\Website\Http\Controllers\Admin\Form\PageLayout::create() */
91
                    /** @see \AbterPhp\Website\Http\Controllers\Admin\Form\PageCategory::create() */
92
                    $router->post(
93
                        "/${route}/new",
94
                        "Admin\Execute\\${controllerName}@create",
95
                        [
96
                            RoutesConstant::OPTION_NAME       => "${route}-create",
97
                            RoutesConstant::OPTION_MIDDLEWARE => [
98
                                Authorization::withParameters(
99
                                    [
100
                                        Authorization::RESOURCE => $route,
101
                                        Authorization::ROLE     => Role::WRITE,
102
                                    ]
103
                                ),
104
                            ],
105
                        ]
106
                    );
107
108
                    /** @see \AbterPhp\Website\Http\Controllers\Admin\Form\Block::edit() */
109
                    /** @see \AbterPhp\Website\Http\Controllers\Admin\Form\BlockLayout::edit() */
110
                    /** @see \AbterPhp\Website\Http\Controllers\Admin\Form\ContentList::edit() */
111
                    /** @see \AbterPhp\Website\Http\Controllers\Admin\Form\Page::edit() */
112
                    /** @see \AbterPhp\Website\Http\Controllers\Admin\Form\PageLayout::edit() */
113
                    /** @see \AbterPhp\Website\Http\Controllers\Admin\Form\PageCategory::edit() */
114
                    $router->get(
115
                        "/${route}/:entityId/edit",
116
                        "Admin\Form\\${controllerName}@edit",
117
                        [
118
                            RoutesConstant::OPTION_NAME       => "${route}-edit",
119
                            RoutesConstant::OPTION_MIDDLEWARE => [
120
                                Authorization::withParameters(
121
                                    [
122
                                        Authorization::RESOURCE => $route,
123
                                        Authorization::ROLE     => Role::WRITE,
124
                                    ]
125
                                ),
126
                            ],
127
                        ]
128
                    );
129
130
                    /** @see \AbterPhp\Website\Http\Controllers\Admin\Execute\Block::update() */
131
                    /** @see \AbterPhp\Website\Http\Controllers\Admin\Execute\BlockLayout::update() */
132
                    /** @see \AbterPhp\Website\Http\Controllers\Admin\Execute\ContentList::update() */
133
                    /** @see \AbterPhp\Website\Http\Controllers\Admin\Execute\Page::update() */
134
                    /** @see \AbterPhp\Website\Http\Controllers\Admin\Execute\PageLayout::update() */
135
                    /** @see \AbterPhp\Website\Http\Controllers\Admin\Execute\PageCategory::update() */
136
                    $router->put(
137
                        "/${route}/:entityId/edit",
138
                        "Admin\Execute\\${controllerName}@update",
139
                        [
140
                            RoutesConstant::OPTION_NAME       => "${route}-update",
141
                            RoutesConstant::OPTION_MIDDLEWARE => [
142
                                Authorization::withParameters(
143
                                    [
144
                                        Authorization::RESOURCE => $route,
145
                                        Authorization::ROLE     => Role::WRITE,
146
                                    ]
147
                                ),
148
                            ],
149
                        ]
150
                    );
151
152
                    /** @see \AbterPhp\Website\Http\Controllers\Admin\Execute\Block::delete() */
153
                    /** @see \AbterPhp\Website\Http\Controllers\Admin\Execute\BlockLayout::delete() */
154
                    /** @see \AbterPhp\Website\Http\Controllers\Admin\Execute\ContentList::delete() */
155
                    /** @see \AbterPhp\Website\Http\Controllers\Admin\Execute\Page::delete() */
156
                    /** @see \AbterPhp\Website\Http\Controllers\Admin\Execute\PageLayout::delete() */
157
                    /** @see \AbterPhp\Website\Http\Controllers\Admin\Execute\PageCategory::delete() */
158
                    $router->get(
159
                        "/${route}/:entityId/delete",
160
                        "Admin\Execute\\${controllerName}@delete",
161
                        [
162
                            RoutesConstant::OPTION_NAME       => "${route}-delete",
163
                            RoutesConstant::OPTION_MIDDLEWARE => [
164
                                Authorization::withParameters(
165
                                    [
166
                                        Authorization::RESOURCE => $route,
167
                                        Authorization::ROLE     => Role::WRITE,
168
                                    ]
169
                                ),
170
                            ],
171
                        ]
172
                    );
173
                }
174
            }
175
        );
176
    }
177
);
178