load() public method

Load a config file into the current instance.
public load ( string $path, string $prefix = '' )
$path string The config file to load.
$prefix string The string to prefix all targets in $path with.
コード例 #1
0
 /**
  * Load a config file and its `.local` file if it exists.
  *
  * @param \MiniAsset\AssetConfig $config The config object to update.
  * @param string $path The config file to load.
  * @param string $prefix The prefix to use.
  * @return void
  */
 protected function _load($config, $path, $prefix = '')
 {
     if (file_exists($path)) {
         $config->load($path, $prefix);
     }
     $localConfig = preg_replace('/(.*)\\.ini$/', '$1.local.ini', $path);
     if (file_exists($localConfig)) {
         $config->load($localConfig, $prefix);
     }
 }
コード例 #2
0
 public function setUp()
 {
     parent::setUp();
     $config = new AssetConfig([]);
     $config->load(APP . 'config/integration.ini');
     $this->factory = new Factory($config);
 }
コード例 #3
0
ファイル: BaseTask.php プロジェクト: markstory/mini-asset
 /**
  * Get the injected config or build a config object from the CLI option.
  *
  * @return \MiniAsset\AssetConfig
  */
 public function config()
 {
     if (!$this->config) {
         $config = new AssetConfig();
         $config->load($this->cli->arguments->get('config'));
         $this->config = $config;
     }
     return $this->config;
 }
コード例 #4
0
 public function testExtendedConfig()
 {
     $config = new AssetConfig();
     $config->load($this->extendConfig);
     $expected = ['classes/base_class.js', 'classes/template.js', 'library_file.js'];
     $this->assertEquals($expected, $config->files('extended.js'));
     $expected = ['classes/base_class.js', 'classes/template.js', 'library_file.js', 'local_script.js'];
     $this->assertEquals($expected, $config->files('more.js'));
     $expected = ['classes/base_class.js', 'classes/template.js', 'library_file.js', 'lots_of_comments.js'];
     $this->assertEquals($expected, $config->files('second.js'));
     $expected = ['Sprockets', 'JsMinFilter'];
     $this->assertEquals($expected, $config->targetFilters('extended.js'));
     $this->assertEquals($expected, $config->targetFilters('more.js'));
     $this->assertTrue($config->isThemed('theme.js'));
 }
コード例 #5
0
ファイル: AssetConfig.php プロジェクト: p-m-d/cobbler
 public function load($path, $prefix = '')
 {
     parent::$_extensionTypes = array_merge(parent::$_extensionTypes, $this->extensions());
     return parent::load($path, $prefix);
 }