Ejemplo n.º 1
0
 /**
  * Initialize method
  *
  * @param Component $Component Component instance
  * @return void
  */
 public function initialize(Component $Component)
 {
     $adapter = $Component->config('adapter');
     if ($adapter) {
         $this->options = $adapter + $this->options;
     }
     $engine = new PhpConfig(dirname($this->options['config']) . DS);
     $config = $engine->read(basename($this->options['config']));
     $this->build($config);
     $Component->Aco = $this->Aco;
     $Component->Aro = $this->Aro;
 }
Ejemplo n.º 2
0
 /**
  * Load a config file containing templates.
  *
  * Template files should define a `$config` variable containing
  * all the templates to load. Loaded templates will be merged with existing
  * templates.
  *
  * @param string $file The file to load
  * @return void
  */
 public function load($file)
 {
     $loader = new PhpConfig(APP . 'Config/');
     $templates = $loader->read($file);
     $this->add($templates);
 }
Ejemplo n.º 3
0
 /**
  * Test that dump() makes files read() can read.
  *
  * @return void
  */
 public function testDumpRead()
 {
     $engine = new PhpConfig(TMP);
     $engine->dump('test.php', $this->testData);
     $result = $engine->read('test.php');
     unlink(TMP . 'test.php');
     $this->assertEquals($this->testData, $result);
 }