Example #1
0
 /**
  * @param $file
  */
 public function load($file)
 {
     if (false === $this->loadersConfigured) {
         $this->loader = $this->getDefaultLoaders();
     }
     $conf = $this->loader->load($file);
     $this->buildFromArray($conf);
 }
Example #2
0
 /**
  * @param string $resource
  *
  * @return mixed
  */
 public function load($resource)
 {
     $id = sprintf('%s/%s.php', $this->cacheDir, crc32($resource));
     if (null === $this->cache) {
         $this->cache = new FileCache();
     }
     $conf = null;
     // check the cache
     if (!$this->cache->contains($id)) {
         // not in cache, delegate to the next loader
         $conf = $this->loader->load($resource);
         // get the list of depending resources
         $this->addDependingResources();
         $this->cache->setResources($this->resources->all());
         $this->resources->clear();
     }
     if (null !== $conf) {
         $this->cache->save($id, $conf);
     }
     if (null === $conf) {
         $conf = $this->cache->fetch($id);
     }
     return $conf;
 }