| Total Complexity | 5 |
| Total Lines | 33 |
| Duplicated Lines | 0 % |
| Coverage | 0% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 8 | class ObblmExtraLoader extends Loader |
||
| 9 | { |
||
| 10 | public const ROUTE_TYPE_NAME = 'obblm'; |
||
| 11 | |||
| 12 | private $isLoaded = false; |
||
| 13 | private $routeAutoloader = false; |
||
| 14 | |||
| 15 | public function __construct(RouteAutoloader $routeAutoloader) |
||
| 18 | } |
||
| 19 | |||
| 20 | public function load($resource, string $type = null) |
||
| 21 | { |
||
| 22 | if (true === $this->isLoaded) { |
||
| 23 | throw new \RuntimeException('Do not add the "extra" loader twice'); |
||
| 24 | } |
||
| 25 | |||
| 26 | $routes = new RouteCollection(); |
||
| 27 | |||
| 28 | foreach ($this->routeAutoloader->getObblmRoutes() as $route) { |
||
| 29 | $importedRoutes = $this->import($route['resource'], $route['type']); |
||
| 30 | $routes->addCollection($importedRoutes); |
||
| 31 | } |
||
| 32 | |||
| 33 | $this->isLoaded = true; |
||
| 34 | |||
| 35 | return $routes; |
||
| 36 | } |
||
| 37 | |||
| 38 | public function supports($resource, string $type = null) |
||
| 41 | } |
||
| 42 | } |
||
| 43 |