| Total Complexity | 3 |
| Total Lines | 39 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 14 | class ApiLoader extends Loader |
||
| 15 | { |
||
| 16 | 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) |
||
| 27 | { |
||
| 28 | if (true === $this->isLoaded) { |
||
| 29 | return null; |
||
| 30 | } |
||
| 31 | |||
| 32 | $routes = new RouteCollection(); |
||
| 33 | |||
| 34 | $resource = '@Sf4ApiBundle/Resources/config/routing.yaml'; |
||
| 35 | $type = 'yaml'; |
||
| 36 | |||
| 37 | $importedRoutes = $this->import($resource, $type); |
||
| 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) |
||
| 53 | } |
||
| 54 | } |
||
| 55 |