fileDefault = "{$container->DIR_CONFIG}/{$file}"; $this->fileCache = "{$container->DIR_CACHE}/generated_bbcode.php"; } /** * Загружает массив сгенерированных bbcode */ public function init(): Model { if (! \is_file($this->fileCache)) { $this->generate(); } $this->list = include $this->fileCache; return $this; } /** * Очищает кеш сгенерированных bbcode */ public function reset(): Model { if (\is_file($this->fileCache)) { if (\unlink($this->fileCache)) { return $this->invalidate(); } else { throw new RuntimeException('The generated bbcode file cannot be deleted'); } } else { return $this; } } /** * Очищает opcache/apc от закэшированного файла */ public function invalidate(): Model { if (\function_exists('\\opcache_invalidate')) { \opcache_invalidate($this->fileCache, true); } elseif (\function_exists('\\apc_delete_file')) { \apc_delete_file($this->fileCache); } return $this; } }