Total Complexity | 3 |
Total Lines | 39 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
14 | class ApiLoader extends Loader |
||
15 | { |
||
16 | public const TYPE = 'sf4_api'; |
||
17 | |||
18 | /** @var bool $isLoaded */ |
||
19 | protected $isLoaded = false; |
||
20 | |||
21 | /** |
||
22 | * @param mixed $resource |
||
23 | * @param null $type |
||
|
|||
24 | * @return RouteCollection|null |
||
25 | */ |
||
26 | public function load($resource, $type = null): ?RouteCollection |
||
27 | { |
||
28 | if (true === $this->isLoaded) { |
||
29 | return null; |
||
30 | } |
||
31 | |||
32 | $routes = new RouteCollection(); |
||
33 | |||
34 | $importedRoutes = $this->import( |
||
35 | '@Sf4ApiBundle/Resources/config/routing.yaml', |
||
36 | 'yaml' |
||
37 | ); |
||
38 | $routes->addCollection($importedRoutes); |
||
39 | |||
40 | $this->isLoaded = true; |
||
41 | |||
42 | return $routes; |
||
43 | } |
||
44 | |||
45 | /** |
||
46 | * @param mixed $resource |
||
47 | * @param null $type |
||
48 | * @return bool |
||
49 | */ |
||
50 | public function supports($resource, $type = null): bool |
||
53 | } |
||
54 | } |
||
55 |