Failed Conditions
Branch master (e37483)
by Maximo
06:09
created

RouterProvider::getCollections()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 4
nc 2
nop 0
dl 0
loc 9
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Canvas\Providers;
6
7
use function Canvas\Core\appPath;
8
use Baka\Router\Providers\RouterProvider as BakaRouterProvider;
9
10
class RouterProvider extends BakaRouterProvider
11
{
12
    /**
13
     * @inheritDoc
14
     *
15
     * @return array
16
     */
17
    protected function getCollections(): array
18
    {
19
        $routerCollections = [];
20
21
        foreach ($this->getRoutes() as $routePath) {
22
            array_push($routerCollections, ...require($routePath));
23
        }
24
25
        return $routerCollections;
26
    }
27
28
    /**
29
     * Returns the array for all the routes on this system.
30
     *
31
     * @return array
32
     */
33
    protected function getRoutes(): array
34
    {
35
        $path = appPath('api/routes');
36
37
        $routes = [
38
            'api' => $path . '/api.php',
39
        ];
40
41
        return $routes;
42
    }
43
}
44