/** * Reads configuration from file. * @param string file name * @return array */ public function loadFromFile($file) { $loader = new NConfigLoader; $res = $loader->load($file); $container = $this->compiler->getContainerBuilder(); foreach ($loader->getDependencies() as $file) { $container->addDependency($file); } return $res; }
/** * Build system container class. * @return string */ protected function buildContainer(& $dependencies) { $loader = new NConfigLoader; $config = array(); $code = "<?php\n"; foreach ($this->files as $tmp) { list($file, $section) = $tmp; $config = NConfigHelpers::merge($loader->load($file, $section), $config); $code .= "// source: $file $section\n"; } $code .= "\n"; $this->checkCompatibility($config); if (!isset($config['parameters'])) { $config['parameters'] = array(); } $config['parameters'] = NConfigHelpers::merge($config['parameters'], $this->params); $compiler = $this->createCompiler(); $this->onCompile($this, $compiler); $code .= $compiler->compile( $config, $this->params['container']['class'], $config['parameters']['container']['parent'] ); $dependencies = array_merge($loader->getDependencies(), $compiler->getContainerBuilder()->getDependencies()); return $code; }