/** * @param RouteCollection $collection * * @return RouteCollection */ public function load() { if ($cachedCollection = $this->cache->fetch('collection.' . $this->type)) { $this->collection->addCollection($cachedCollection); return $this->collection; } $loaderResolver = new LoaderResolver($this->loaders); $delegatingLoader = new DelegatingLoader($loaderResolver); foreach ($this->resources as $resource) { $this->collection->addCollection($delegatingLoader->load($resource)); } $this->cache->save('collection.' . $this->type, $this->collection); return $this->collection; }
public function testAddCollection() { $routeCollectionA = new RouteCollection(['routeA' => $this->routes['routeA'], 'routeB' => $this->routes['routeB']]); $routeCollectionB = new RouteCollection(['routeC' => $this->routes['routeC']]); $routeCollectionA->addCollection($routeCollectionB); $this->assertEquals($this->routes, $this->readProperty($routeCollectionA, 'routes')); }