Passed
Push — master ( 2c4864...65658d )
by Peter
02:43
created

api-routes.php (3 issues)

Labels
Severity
1
<?php
2
3
declare(strict_types=1);
4
5
use AbterPhp\Admin\Constant\Routes;
6
use Opulence\Routing\Router;
7
use AbterPhp\Admin\Http\Middleware\Api;
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\Admin\\Http\\Controllers'],
18
    function (Router $router) {
19
        $router->group(
20
            [
21
                'path' => PATH_API,
0 ignored issues
show
The constant PATH_API was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
22
            ],
23
            function (Router $router) {
24
                /** @see \AbterPhp\Admin\Http\Controllers\Api\AccessToken::create() */
25
                $router->post(
26
                    Routes::PATH_ACCESS_TOKEN,
27
                    'Api\AccessToken@create',
28
                    [
29
                        OPTION_NAME => Routes::ROUTE_ACCESS_TOKEN,
0 ignored issues
show
The constant OPTION_NAME was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
30
                    ]
31
                );
32
            }
33
        );
34
        $router->group(
35
            [
36
                'path' => PATH_API,
37
                'middleware' => [
38
                    Api::class,
39
                ],
40
            ],
41
            function (Router $router) {
42
                /** @see \AbterPhp\Admin\Http\Controllers\Api\User::create() */
43
                $router->post(
44
                    Routes::PATH_USERS,
45
                    'Api\User@create'
46
                );
47
48
                /** @see \AbterPhp\Admin\Http\Controllers\Api\User::update() */
49
                $router->put(
50
                    Routes::PATH_USERS_ENTITY,
51
                    'Api\User@update'
52
                );
53
54
                /** @see \AbterPhp\Framework\Http\Controllers\Api\Index::notFound() */
55
                $router->any(
56
                    Routes::PATH_404,
57
                    'Api\Index@notFound',
58
                    [
59
                        OPTION_VARS => [Routes::VAR_ANYTHING => '.+'],
0 ignored issues
show
The constant OPTION_VARS was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
60
                    ]
61
                );
62
            }
63
        );
64
    }
65
);
66