Checks if kernel configuration has enabled specific feature
public hasFeature ( integer $featureToCheck ) : boolean | ||
$featureToCheck | integer | See Go\Aop\Features enumeration class for features |
Résultat | boolean | Whether specific feature enabled or not |
public function __construct(AspectKernel $kernel) { $this->kernel = $kernel; $this->options = $kernel->getOptions(); $this->cacheDir = $this->options['cacheDir']; $this->appDir = $this->options['appDir']; if ($this->cacheDir) { if (!is_dir($this->cacheDir)) { $cacheRootDir = dirname($this->cacheDir); if (!is_writable($cacheRootDir) || !is_dir($cacheRootDir)) { throw new \InvalidArgumentException("Can not create a directory {$this->cacheDir} for the cache.\n Parent directory {$cacheRootDir} is not writable or not exist."); } mkdir($this->cacheDir, 0770); } if (!$this->kernel->hasFeature(Features::PREBUILT_CACHE) && !is_writable($this->cacheDir)) { throw new \InvalidArgumentException("Cache directory {$this->cacheDir} is not writable"); } if (file_exists($this->cacheDir . self::CACHE_FILE_NAME)) { $this->cacheState = (include $this->cacheDir . self::CACHE_FILE_NAME); } } }