コード例 #1
0
 public function testSet()
 {
     $this->config->load(__DIR__ . '/Fixtures/config2.php');
     $this->config->set('mail.from.address', '*****@*****.**');
     $this->assertEquals($this->config->get('mail.from.address'), '*****@*****.**');
     $this->config->offsetSet('foo.bar', 'fooBar');
     $this->assertTrue($this->config->offsetExists('foo.bar'));
     $this->assertEquals($this->config->offsetGet('foo.bar'), 'fooBar');
     $this->config->offsetUnset('foo.bar');
     $this->assertEquals($this->config->offsetGet('foo.bar'), null);
 }
コード例 #2
0
 /**
  * Constructor.
  */
 public function __construct()
 {
     $this->config = new Config();
     $this->config->load($this->configFile = $this['config.file']);
 }
コード例 #3
0
ファイル: config.php プロジェクト: amirkheirabadi/pagekit
<?php

use Pagekit\Component\Config\Config;
$values = array_map('realpath', ['path' => __DIR__ . '/..', 'path.cache' => __DIR__ . '/cache', 'path.logs' => __DIR__ . '/logs', 'path.temp' => __DIR__ . '/temp', 'path.extensions' => __DIR__ . '/../extensions', 'path.storage' => __DIR__ . '/../storage', 'path.themes' => __DIR__ . '/../themes', 'path.vendor' => __DIR__ . '/../vendor', 'config.file' => __DIR__ . '/../config.php']);
$config = new Config($values);
$config->load(__DIR__ . '/config/app.php');
if ($values['config.file']) {
    $config->load($values['config.file']);
}
if ($config['app.nocache']) {
    $config->set('cache.storage', 'array');
}
$values['config'] = $config;
return $values;