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

api-routes.php (2 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\Api;
0 ignored issues
show
The type AbterPhp\Admin\Http\Middleware\Api 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 Opulence\Routing\Router;
8
9
/**
10
 * ----------------------------------------------------------
11
 * Create all of the routes for the HTTP kernel
12
 * ----------------------------------------------------------
13
 *
14
 * @var Router $router
15
 */
16
$router->group(
17
    ['controllerNamespace' => 'AbterPhp\Website\Http\Controllers'],
18
    function (Router $router) {
19
        $router->group(
20
            [
21
                'path' => RoutesConfig::getApiBasePath(),
22
                'middleware' => [
23
                    Api::class,
24
                ],
25
            ],
26
            function (Router $router) {
27
                $entities = [
28
                    'pages'          => 'Page',
29
                    'page-layouts'    => 'PageLayout',
30
                    'page-categories' => 'PageCategory',
31
                    'blocks'         => 'Block',
32
                    'block-layouts'   => 'BlockLayout',
33
                ];
34
35
                foreach ($entities as $route => $controllerName) {
36
                    /** @see \AbterPhp\Website\Http\Controllers\Api\Page::get() */
37
                    /** @see \AbterPhp\Website\Http\Controllers\Api\PageLayout::get() */
38
                    /** @see \AbterPhp\Website\Http\Controllers\Api\PageCategory::get() */
39
                    /** @see \AbterPhp\Website\Http\Controllers\Api\Block::get() */
40
                    /** @see \AbterPhp\Website\Http\Controllers\Api\BlockLayout::get() */
41
                    $router->get(
42
                        "/${route}/:entityId",
43
                        "Api\\${controllerName}@get"
44
                    );
45
46
                    /** @see \AbterPhp\Website\Http\Controllers\Api\Page::list() */
47
                    /** @see \AbterPhp\Website\Http\Controllers\Api\PageLayout::list() */
48
                    /** @see \AbterPhp\Website\Http\Controllers\Api\PageCategory::list() */
49
                    /** @see \AbterPhp\Website\Http\Controllers\Api\Block::list() */
50
                    /** @see \AbterPhp\Website\Http\Controllers\Api\BlockLayout::list() */
51
                    $router->get(
52
                        "/${route}",
53
                        "Api\\${controllerName}@list"
54
                    );
55
56
                    /** @see \AbterPhp\Website\Http\Controllers\Api\Page::create() */
57
                    /** @see \AbterPhp\Website\Http\Controllers\Api\PageLayout::create() */
58
                    /** @see \AbterPhp\Website\Http\Controllers\Api\PageCategory::create() */
59
                    /** @see \AbterPhp\Website\Http\Controllers\Api\Block::create() */
60
                    /** @see \AbterPhp\Website\Http\Controllers\Api\BlockLayout::create() */
61
                    $router->post(
62
                        "/${route}",
63
                        "Api\\${controllerName}@create"
64
                    );
65
66
                    /** @see \AbterPhp\Website\Http\Controllers\Api\Page::update() */
67
                    /** @see \AbterPhp\Website\Http\Controllers\Api\PageLayout::update() */
68
                    /** @see \AbterPhp\Website\Http\Controllers\Api\PageCategory::update() */
69
                    /** @see \AbterPhp\Website\Http\Controllers\Api\Block::update() */
70
                    /** @see \AbterPhp\Website\Http\Controllers\Api\BlockLayout::update() */
71
                    $router->put(
72
                        "/${route}/:entityId",
73
                        "Api\\${controllerName}@update"
74
                    );
75
76
                    /** @see \AbterPhp\Website\Http\Controllers\Api\Page::delete() */
77
                    /** @see \AbterPhp\Website\Http\Controllers\Api\PageLayout::delete() */
78
                    /** @see \AbterPhp\Website\Http\Controllers\Api\PageCategory::delete() */
79
                    /** @see \AbterPhp\Website\Http\Controllers\Api\Block::delete() */
80
                    /** @see \AbterPhp\Website\Http\Controllers\Api\BlockLayout::delete() */
81
                    $router->delete(
82
                        "/${route}/:entityId",
83
                        "Api\\${controllerName}@delete"
84
                    );
85
                }
86
            }
87
        );
88
    }
89
);
90