/** * Register blade engine in Bitrix. * * @param string $baseViewPath * @param string $cachePath */ public static function register($baseViewPath = 'local/views', $cachePath = 'bitrix/cache/blade') { static::$baseViewPath = $_SERVER['DOCUMENT_ROOT'] . '/' . $baseViewPath; static::$cachePath = $_SERVER['DOCUMENT_ROOT'] . '/' . $cachePath; static::instantiateServiceContainer(); static::instantiateViewFactory(); global $arCustomTemplateEngines; $arCustomTemplateEngines['blade'] = ['templateExt' => ['blade'], 'function' => 'renderBladeTemplate']; }
/** * @param string $appPath * @param string $env * * @return CompiledContainer */ public static function getContainer($appPath, $env = null) { static::$appPath = $appPath; static::$cachePath = $appPath . '/app/cache'; static::$configPath = $appPath . '/app/config'; $containerCacheFile = static::$cachePath . '/container.php'; $containerConfigCache = new ConfigCache($containerCacheFile, $env != 'prod'); if (!$containerConfigCache->isFresh()) { $containerBuilder = static::buildContainer(); $dumper = new PhpDumper($containerBuilder); $containerConfigCache->write($dumper->dump(array('class' => 'CompiledContainer')), $containerBuilder->getResources()); } require_once $containerCacheFile; $container = new CompiledContainer(); return $container; }
/** * Enable the generator. * * @param object $source Source object to use * @param string $cache_path Directory to save the cache files */ public static function enable($source, $cache_path = null) { static::$source = $source; static::$cachePath = $cache_path; $class = get_called_class() === __CLASS__ ? static::getDriver($source) : get_called_class(); spl_autoload_register([$class, 'autoload']); }
/** * Sets the cache path of this webapp. The folder specified should allow * the PHP-running user full read/write access to it and its contents. * The supplied path may be absolute or relative. If relative, the path * will be resolved relative to the base path if it exists. * * This configuration value is not accessed or changed with the rest of the * config options, because core configuration functions depend on this * value. This function should be called before any config file is loaded. * Normally, this will be the second method called in * hydrogen.autoconfig.php, right after {@link #setBasePath}. * * @param cachePath The absolute or relative path to a folder for which * PHP has full read and write permissions. * @throws InvalidPathException if the provided path is relative and * {@link #setBasePath} has not been successfully called. */ public static function setCachePath($cachePath) { $cachePath = static::getAbsolutePath($cachePath); // Remove trailing slash(es) while ($cachePath[strlen($cachePath) - 1] === DIRECTORY_SEPARATOR) { $cachePath = substr($cachePath, 0, strlen($cachePath) - 1); } static::$cachePath = $cachePath; }
static function setCachePath($cp) { static::$cachePath = $cp; }
/** * Method to set property cachePath * * @param string $cachePath * * @return void */ public static function setCachePath($cachePath) { static::$cachePath = $cachePath; }