MiniAsset\AssetConfig::set PHP Метод

set() публичный Метод

Set values into the config object, You can't modify targets, or filters with this. Use the appropriate methods for those settings.
public set ( string $path, string $value )
$path string The path to set.
$value string The value to set.
    public function set($path, $value)
    {
        $parts = explode('.', $path);
        switch (count($parts)) {
            case 2:
                $this->_data[$parts[0]][$parts[1]] = $value;
                break;
            case 1:
                $this->_data[$parts[0]] = $value;
                break;
            case 0:
                throw new RuntimeException('Path was empty.');
            default:
                throw new RuntimeException('Too many parts in path.');
        }
    }

Usage Example

Пример #1
0
 public function __construct(Module $modules, Module\Loader $load)
 {
     $configs = new AssetConfig($this->configs);
     if (!($cache_path = config_item('cache_path'))) {
         $cache_path = FCPATH . 'asset/cache/';
         config_item('cache_path', $cache_path);
     }
     $configs->cachePath('js', $cache_path . 'js');
     $configs->cachePath('css', $cache_path . 'css');
     foreach ($modules->getList('module') as $module) {
         $configs->set('js.paths', $module->path . 'asset/scripts/**');
         $configs->set('css.paths', $module->path . 'asset/styles/**');
     }
     $this->factory = new Factory($configs);
 }