MiniAsset\AssetConfig::general PHP Method

general() public method

Get / set values from the General section. This is preferred to using get()/set() as you don't run the risk of making a mistake in General's casing.
public general ( string $key, mixed $value = null ) : mixed
$key string The key to read/write
$value mixed The value to set.
return mixed Null when writing. Either a value or null when reading.
    public function general($key, $value = null)
    {
        if ($value === null) {
            return isset($this->_data[self::GENERAL][$key]) ? $this->_data[self::GENERAL][$key] : null;
        }
        $this->_data[self::GENERAL][$key] = $value;
    }

Usage Example

コード例 #1
0
 /**
  * clear the builds for a specific extension.
  *
  * @return void
  */
 protected function _clearBuilds()
 {
     $themes = (array) $this->config->general('themes');
     if ($themes) {
         $this->config->theme($themes[0]);
     }
     $assets = $this->factory->assetCollection();
     if (count($assets) === 0) {
         $this->err('No build targets defined, skipping');
         return;
     }
     $targets = array_map(function ($target) {
         return $target->name();
     }, iterator_to_array($assets));
     $this->_clearPath(CACHE . 'asset_compress' . DS, $themes, $targets);
     $this->_clearPath($this->config->cachePath('js'), $themes, $targets);
     $this->_clearPath($this->config->cachePath('css'), $themes, $targets);
 }