本文整理汇总了PHP中Symfony\Component\HttpKernel\KernelInterface::getCacheDir方法的典型用法代码示例。如果您正苦于以下问题:PHP KernelInterface::getCacheDir方法的具体用法?PHP KernelInterface::getCacheDir怎么用?PHP KernelInterface::getCacheDir使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Symfony\Component\HttpKernel\KernelInterface
的用法示例。
在下文中一共展示了KernelInterface::getCacheDir方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: writeCache
protected function writeCache(array $menu)
{
$file = $this->kernel->getCacheDir() . '/' . self::CACHE_FILENAME;
$content = sprintf('<?php return %s;', var_export($menu, true));
$fs = new Filesystem();
$fs->dumpFile($file, $content);
}
示例2: getMetadataCache
/**
* @return mixed
*/
protected function getMetadataCache()
{
if (empty($this->cache)) {
if (is_file($cache = $this->kernel->getCacheDir() . '/' . self::CACHE_FILENAME)) {
$this->cache = (require $cache);
}
}
return $this->cache;
}
示例3: getConfigurations
/**
* @return array
*/
public function getConfigurations()
{
if ($this->configuration !== null) {
return $this->configuration;
}
$cacheFilePath = sprintf('%s/%s', $this->kernel->getCacheDir(), self::CACHE_FILE_NAME);
$configuration = json_decode($this->filesystem->readFile($cacheFilePath), true);
$this->configuration = $configuration;
return $configuration;
}
示例4: loadBundles
/**
* @return \Symfony\Component\HttpKernel\Bundle\BundleInterface
*/
public function loadBundles()
{
$bundles = [];
if (is_file($cache = $this->kernel->getCacheDir() . '/' . self::CACHE_FILENAME)) {
$bundleClasses = (require $cache);
} else {
$bundleClasses = $this->getManagedBundleClasses();
}
foreach ($bundleClasses as $bundleClass) {
$bundles[] = new $bundleClass();
}
return $bundles;
}
示例5: resolveAndReturnBundleDependencies
/**
* Resolve all bundle dependencies and return them all in a single array.
*
* @param KernelInterface $kernel Kernel
* @param array $bundles Bundles defined by instances or namespaces
*
* @return Bundle[]|string[] Bundle definitions
*/
protected function resolveAndReturnBundleDependencies(KernelInterface $kernel, array $bundles)
{
$cacheFile = $kernel->getCacheDir() . '/kernelDependenciesStack.php';
if (!is_dir($kernel->getCacheDir())) {
mkdir($kernel->getCacheDir(), 0777, true);
}
if (file_exists($cacheFile)) {
return include $cacheFile;
}
$bundleStack = $this->originalResolveAndReturnBundleDependencies($kernel, $bundles);
$this->cacheBuiltBundleStack($bundleStack, $cacheFile);
return $bundleStack;
}
示例6: __construct
/**
* Constructor
*
* @param KernelInterface $kernel
*/
public function __construct(KernelInterface $kernel)
{
// register email address proxy class loader
$loader = new UniversalClassLoader();
$loader->registerNamespaces([self::ENTITY_PROXY_NAMESPACE => $kernel->getCacheDir() . DIRECTORY_SEPARATOR . self::CACHED_ENTITIES_DIR_NAME]);
$loader->register();
}
示例7: __construct
/**
* Constructor
*
* @param KernelInterface $kernel
*/
public function __construct(KernelInterface $kernel)
{
// register logging hydrators class loader
$loader = new ClassLoader();
$loader->addPrefix('OroLoggingHydrator\\', $kernel->getCacheDir() . DIRECTORY_SEPARATOR . 'oro_entities');
$loader->register();
}
示例8: getCacheDir
/**
* @return string
*/
private function getCacheDir()
{
$cacheDir = $this->kernel->getCacheDir() . '/' . 'faker';
if (!is_dir($cacheDir)) {
mkdir($cacheDir);
}
return $cacheDir;
}
示例9: getMetadataArray
private function getMetadataArray()
{
if ($this->metadataArray === null) {
$cacheFilePath = sprintf('%s/%s', $this->kernel->getCacheDir(), MetadataCollection::CACHE_FILE_NAME);
$content = file_get_contents($cacheFilePath);
$this->metadataArray = json_decode($content, true);
}
return $this->metadataArray;
}
示例10: clearDiCache
private function clearDiCache()
{
$finder = new Finder();
$finder->in($this->kernel->getCacheDir());
$finder->name('*.php');
$finder->name('*.php.meta');
$filesystem = new Filesystem();
$filesystem->remove($finder);
}
示例11: getLastMappingValidateFilePath
/**
* @return string
*/
protected function getLastMappingValidateFilePath()
{
return $this->kernel->getCacheDir() . DIRECTORY_SEPARATOR . 'dev_bundle_last_mapping_validate';
}
示例12: needsBuild
/**
* {@inheritDocs}
*/
public function needsBuild()
{
return !file_exists($this->kernel->getCacheDir() . '/propel-classes/');
}
示例13: read
/**
* @return array
*/
public function read()
{
$cacheScriptPath = $this->kernel->getCacheDir() . self::CACHE_SCRIPT_PATH;
return require $cacheScriptPath;
}
示例14: __construct
public function __construct(KernelInterface $kernel)
{
$this->kernel = $kernel;
$this->cacheDir = $kernel->getCacheDir();
ExtendClassLoadingUtils::registerClassLoader($this->cacheDir);
}
示例15: getSettingArrayFromCache
protected function getSettingArrayFromCache()
{
$cacheFilePath = sprintf('%s/%s', $this->kernel->getCacheDir(), self::CACHE_FILE_NAME);
$settingArray = json_decode($this->fileSystem->readFile($cacheFilePath), $assoc = true);
return array_filter($settingArray);
}