Passed
Push — master ( 9c7246...3b2dd4 )
by Peter
03:42
created

api-routes.php (2 issues)

Labels
Severity
1
<?php
2
3
declare(strict_types=1);
4
5
use AbterPhp\Admin\Http\Middleware\Api;
6
use AbterPhp\Admin\Http\Middleware\Authentication;
7
use AbterPhp\Admin\Http\Middleware\Authorization;
8
use AbterPhp\Admin\Http\Middleware\LastGridPage;
9
use AbterPhp\Files\Constant\Routes;
0 ignored issues
show
The type AbterPhp\Files\Constant\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...
10
use AbterPhp\Framework\Authorization\Constant\Role;
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'       => PATH_API,
1 ignored issue
show
The constant PATH_API was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
26
                'middleware' => [
27
                    Api::class,
28
                ],
29
            ],
30
            function (Router $router) {
31
                $entities = [
32
                    'pages'          => 'Page',
33
                    'pagelayouts'    => 'PageLayout',
34
                    'pagecategories' => 'PageCategory',
35
                    'blocks'         => 'Block',
36
                    'blocklayouts'   => 'BlockLayout',
37
                ];
38
39
                foreach ($entities as $route => $controllerName) {
40
                    /** @see \AbterPhp\Admin\Http\Controllers\Api\Page::create() */
41
                    /** @see \AbterPhp\Admin\Http\Controllers\Api\PageLayout::create() */
42
                    /** @see \AbterPhp\Admin\Http\Controllers\Api\PageCategory::create() */
43
                    /** @see \AbterPhp\Admin\Http\Controllers\Api\Block::create() */
44
                    /** @see \AbterPhp\Admin\Http\Controllers\Api\BlockLayout::create() */
45
                    $router->post(
46
                        "/${route}",
47
                        "Api\\${controllerName}@create"
48
                    );
49
50
                    /** @see \AbterPhp\Admin\Http\Controllers\Api\Page::update() */
51
                    /** @see \AbterPhp\Admin\Http\Controllers\Api\PageLayout::update() */
52
                    /** @see \AbterPhp\Admin\Http\Controllers\Api\PageCategory::update() */
53
                    /** @see \AbterPhp\Admin\Http\Controllers\Api\Block::update() */
54
                    /** @see \AbterPhp\Admin\Http\Controllers\Api\BlockLayout::update() */
55
                    $router->put(
56
                        "/${route}/:entityId",
57
                        "Api\\${controllerName}@update"
58
                    );
59
60
                    /** @see \AbterPhp\Admin\Http\Controllers\Api\Page::delete() */
61
                    /** @see \AbterPhp\Admin\Http\Controllers\Api\PageLayout::delete() */
62
                    /** @see \AbterPhp\Admin\Http\Controllers\Api\PageCategory::delete() */
63
                    /** @see \AbterPhp\Admin\Http\Controllers\Api\Block::delete() */
64
                    /** @see \AbterPhp\Admin\Http\Controllers\Api\BlockLayout::delete() */
65
                    $router->delete(
66
                        "/${route}/:entityId",
67
                        "Api\\${controllerName}@delete"
68
                    );
69
                }
70
            }
71
        );
72
    }
73
);
74