本文整理汇总了PHP中Symfony\Component\HttpKernel\KernelInterface::getLogDir方法的典型用法代码示例。如果您正苦于以下问题:PHP KernelInterface::getLogDir方法的具体用法?PHP KernelInterface::getLogDir怎么用?PHP KernelInterface::getLogDir使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Symfony\Component\HttpKernel\KernelInterface
的用法示例。
在下文中一共展示了KernelInterface::getLogDir方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getTempKernel
/**
* @param KernelInterface $parent
* @param string $namespace
* @param string $parentClass
* @param string $warmupDir
*
* @return KernelInterface
*/
protected function getTempKernel(KernelInterface $parent, $namespace, $parentClass, $warmupDir)
{
$cacheDir = var_export($warmupDir, true);
$rootDir = var_export(realpath($parent->getRootDir()), true);
$logDir = var_export(realpath($parent->getLogDir()), true);
// the temp kernel class name must have the same length than the real one
// to avoid the many problems in serialized resources files
$class = substr($parentClass, 0, -1) . '_';
// the temp kernel name must be changed too
$name = var_export(substr($parent->getName(), 0, -1) . '_', true);
$code = <<<EOF
<?php
namespace {$namespace}
{
class {$class} extends {$parentClass}
{
public function getCacheDir()
{
return {$cacheDir};
}
public function getName()
{
return {$name};
}
public function getRootDir()
{
return {$rootDir};
}
public function getLogDir()
{
return {$logDir};
}
protected function buildContainer()
{
\$container = parent::buildContainer();
// filter container's resources, removing reference to temp kernel file
\$resources = \$container->getResources();
\$filteredResources = array();
foreach (\$resources as \$resource) {
if ((string) \$resource !== __FILE__) {
\$filteredResources[] = \$resource;
}
}
\$container->setResources(\$filteredResources);
return \$container;
}
}
}
EOF;
$this->getContainer()->get('filesystem')->mkdir($warmupDir);
file_put_contents($file = $warmupDir . '/kernel.tmp', $code);
require_once $file;
$class = "{$namespace}\\{$class}";
return new $class($parent->getEnvironment(), $parent->isDebug());
}
示例2: getLogDir
/**
* {@inheritdoc}
*/
public function getLogDir()
{
return $this->kernel->getLogDir();
}