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

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

Get values from the config data.
public get ( string $path )
$path string The path you want.
    public function get($path)
    {
        $parts = explode('.', $path);
        switch (count($parts)) {
            case 2:
                if (isset($this->_data[$parts[0]][$parts[1]])) {
                    return $this->_data[$parts[0]][$parts[1]];
                }
                break;
            case 1:
                if (isset($this->_data[$parts[0]])) {
                    return $this->_data[$parts[0]];
                }
                break;
            case 0:
                throw new RuntimeException('Path was empty.');
            default:
                throw new RuntimeException('Too many parts in path.');
        }
    }

Usage Example

Пример #1
0
 /**
  * Create an AssetWriter
  *
  * @param string $tmpPath The path where the build timestamp lookup should be stored.
  * @return MiniAsset\AssetWriter
  */
 public function writer($tmpPath = '')
 {
     if (!$tmpPath) {
         $tmpPath = sys_get_temp_dir() . DIRECTORY_SEPARATOR;
     }
     $timestamp = ['js' => $this->config->get('js.timestamp'), 'css' => $this->config->get('css.timestamp')];
     $writer = new AssetWriter($timestamp, $tmpPath, $this->config->theme());
     $writer->configTimestamp($this->config->modifiedTime());
     $writer->filterRegistry($this->filterRegistry());
     return $writer;
 }