当前位置: 首页>>代码示例>>PHP>>正文


PHP KernelInterface::isDebug方法代码示例

本文整理汇总了PHP中Symfony\Component\HttpKernel\KernelInterface::isDebug方法的典型用法代码示例。如果您正苦于以下问题:PHP KernelInterface::isDebug方法的具体用法?PHP KernelInterface::isDebug怎么用?PHP KernelInterface::isDebug使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Symfony\Component\HttpKernel\KernelInterface的用法示例。


在下文中一共展示了KernelInterface::isDebug方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: warmUp

 /**
  * @param string $cacheDir
  */
 public function warmUp($cacheDir)
 {
     $mapFile = $cacheDir . '/classes.map';
     if (is_file($mapFile)) {
         ClassCollectionLoader::load(include $mapFile, $cacheDir, 'classes', $this->kernel->isDebug(), false, '.php');
     }
 }
开发者ID:benr77,项目名称:ClassesCacheWarmerBundle,代码行数:10,代码来源:ClassesCacheWarmer.php

示例2: configureContext

 /**
  * {@inheritdoc}
  */
 public function configureContext(ContextInterface $context)
 {
     $context->getResolver()->setDefaults(['debug' => function (Options $options, $value) {
         if (null === $value) {
             $value = $this->kernel->isDebug();
         }
         return $value;
     }])->setAllowedTypes(['debug' => 'bool']);
 }
开发者ID:Maksold,项目名称:platform,代码行数:12,代码来源:ApplicationContextConfigurator.php

示例3: getKernel

 /**
  * @return KernelInterface
  */
 private function getKernel(InputInterface $input)
 {
     $env = $input->getParameterOption(['--env', '-e'], $this->baseKernel->getEnvironment());
     $debug = !$input->hasParameterOption(['--no-debug', '']);
     if ($env === $this->baseKernel->getEnvironment() && $debug === $this->baseKernel->isDebug()) {
         return $this->baseKernel;
     }
     $kernelClass = new ReflectionClass($this->baseKernel);
     return $kernelClass->newInstance([$env, $debug]);
 }
开发者ID:blutch89,项目名称:library-sf2,代码行数:13,代码来源:CommandExecuter.php

示例4: collect

 /**
  * {@inheritdoc}
  */
 public function collect(Request $request, Response $response, \Exception $exception = null)
 {
     $this->data = array('app_name' => $this->name, 'app_version' => $this->version, 'token' => $response->headers->get('X-Debug-Token'), 'symfony_version' => Kernel::VERSION, 'symfony_state' => 'unknown', 'name' => isset($this->kernel) ? $this->kernel->getName() : 'n/a', 'env' => isset($this->kernel) ? $this->kernel->getEnvironment() : 'n/a', 'debug' => isset($this->kernel) ? $this->kernel->isDebug() : 'n/a', 'php_version' => PHP_VERSION, 'xdebug_enabled' => extension_loaded('xdebug'), 'eaccel_enabled' => extension_loaded('eaccelerator') && ini_get('eaccelerator.enable'), 'apc_enabled' => extension_loaded('apc') && ini_get('apc.enabled'), 'xcache_enabled' => extension_loaded('xcache') && ini_get('xcache.cacher'), 'wincache_enabled' => extension_loaded('wincache') && ini_get('wincache.ocenabled'), 'zend_opcache_enabled' => extension_loaded('Zend OPcache') && ini_get('opcache.enable'), 'bundles' => array(), 'sapi_name' => PHP_SAPI);
     if (isset($this->kernel)) {
         foreach ($this->kernel->getBundles() as $name => $bundle) {
             $this->data['bundles'][$name] = $bundle->getPath();
         }
         $this->data['symfony_state'] = $this->determineSymfonyState();
     }
 }
开发者ID:yceruto,项目名称:symfony,代码行数:13,代码来源:ConfigDataCollector.php

示例5: __construct

 /**
  * Constructor.
  *
  * @param KernelInterface $kernel A KernelInterface instance
  */
 public function __construct(KernelInterface $kernel)
 {
     $this->kernel = $kernel;
     parent::__construct('Symfony', Kernel::VERSION . ' - ' . $kernel->getName() . '/' . $kernel->getEnvironment() . ($kernel->isDebug() ? '/debug' : ''));
     $this->getDefinition()->addOption(new InputOption('--env', '-e', InputOption::VALUE_REQUIRED, 'The Environment name.', $kernel->getEnvironment()));
     $this->getDefinition()->addOption(new InputOption('--no-debug', null, InputOption::VALUE_NONE, 'Switches off debug mode.'));
 }
开发者ID:Ener-Getick,项目名称:symfony,代码行数:12,代码来源:Application.php

示例6: onInstallSamples

 /**
  * @param Samples $event
  */
 public function onInstallSamples(SamplesInstall $event)
 {
     // app already installed
     if ($this->installed) {
         return;
     }
     // sample label
     $name = $this->translator->trans('Sample');
     $label = $this->em->getRepository('AnimeDbCatalogBundle:Label')->findOneBy(['name' => $name]);
     $label = $label ?: (new Label())->setName($name);
     $status = false;
     // create items
     foreach ($this->item_chain->getPublicItems() as $item) {
         $status = $this->persist($item, $event->getStorage(), $label) ?: $status;
     }
     // install more items only for debug mode
     if ($this->kernel->isDebug()) {
         foreach ($this->item_chain->getDebugItems() as $item) {
             $status = $this->persist($item, $event->getStorage(), $label) ?: $status;
         }
     }
     if ($status) {
         $this->em->flush();
     }
 }
开发者ID:anime-db,项目名称:catalog-bundle,代码行数:28,代码来源:Install.php

示例7: __construct

 /**
  * Constructor.
  *
  * @param KernelInterface $kernel A KernelInterface instance
  */
 public function __construct(KernelInterface $kernel)
 {
     $this->kernel = $kernel;
     parent::__construct('Symfony', Kernel::VERSION . ' - ' . $kernel->getName() . '/' . $kernel->getEnvironment() . ($kernel->isDebug() ? '/debug' : ''));
     $this->getDefinition()->addOption(new InputOption('--shell', '-s', InputOption::VALUE_NONE, 'Launch the shell.'));
     $this->getDefinition()->addOption(new InputOption('--process-isolation', null, InputOption::VALUE_NONE, 'Launch commands from shell as a separate processes.'));
     $this->getDefinition()->addOption(new InputOption('--env', '-e', InputOption::VALUE_REQUIRED, 'The Environment name.', $kernel->getEnvironment()));
     $this->getDefinition()->addOption(new InputOption('--no-debug', null, InputOption::VALUE_NONE, 'Switches off debug mode.'));
 }
开发者ID:TeamA-ict,项目名称:TeamA,代码行数:14,代码来源:Application.php

示例8: __construct

 /**
  * Constructor.
  */
 public function __construct(KernelInterface $kernel)
 {
     $this->kernel = $kernel;
     parent::__construct('Symfony', Kernel::VERSION . ' - ' . $kernel->getName() . '/' . $kernel->getEnvironment() . ($kernel->isDebug() ? '/debug' : ''));
     $this->definition->addOption(new InputOption('--shell', '-s', InputOption::VALUE_NONE, 'Launch the shell.'));
     $this->definition->addOption(new InputOption('--env', '-e', InputOption::VALUE_REQUIRED, 'The Environment name.', 'dev'));
     $this->definition->addOption(new InputOption('--debug', '-d', InputOption::VALUE_NONE, 'Whether to run in debug mode.'));
     $this->kernel->boot();
     $this->registerCommands();
 }
开发者ID:noelg,项目名称:symfony-demo,代码行数:13,代码来源:Application.php

示例9: collect

    /**
     * {@inheritdoc}
     */
    public function collect(Request $request, Response $response, \Exception $exception = null)
    {
        $this->data = array(
            'app_name' => $this->name,
            'app_version' => $this->version,
            'token' => $response->headers->get('X-Debug-Token'),
            'symfony_version' => Kernel::VERSION,
            'symfony_state' => 'unknown',
            'name' => isset($this->kernel) ? $this->kernel->getName() : 'n/a',
            'env' => isset($this->kernel) ? $this->kernel->getEnvironment() : 'n/a',
            'debug' => isset($this->kernel) ? $this->kernel->isDebug() : 'n/a',
            'php_version' => PHP_VERSION,
            'php_architecture' => PHP_INT_SIZE * 8,
            'php_intl_locale' => class_exists('Locale', false) && \Locale::getDefault() ? \Locale::getDefault() : 'n/a',
            'php_timezone' => date_default_timezone_get(),
            'xdebug_enabled' => extension_loaded('xdebug'),
            'apcu_enabled' => extension_loaded('apcu') && ini_get('apc.enabled'),
            'zend_opcache_enabled' => extension_loaded('Zend OPcache') && ini_get('opcache.enable'),
            'bundles' => array(),
            'sapi_name' => PHP_SAPI,
        );

        if (isset($this->kernel)) {
            foreach ($this->kernel->getBundles() as $name => $bundle) {
                $this->data['bundles'][$name] = $bundle->getPath();
            }

            $this->data['symfony_state'] = $this->determineSymfonyState();
            $this->data['symfony_minor_version'] = sprintf('%s.%s', Kernel::MAJOR_VERSION, Kernel::MINOR_VERSION);
            $eom = \DateTime::createFromFormat('m/Y', Kernel::END_OF_MAINTENANCE);
            $eol = \DateTime::createFromFormat('m/Y', Kernel::END_OF_LIFE);
            $this->data['symfony_eom'] = $eom->format('F Y');
            $this->data['symfony_eol'] = $eol->format('F Y');
        }

        if (preg_match('~^(\d+(?:\.\d+)*)(.+)?$~', $this->data['php_version'], $matches) && isset($matches[2])) {
            $this->data['php_version'] = $matches[1];
            $this->data['php_version_extra'] = $matches[2];
        }
    }
开发者ID:symfony,项目名称:symfony,代码行数:43,代码来源:ConfigDataCollector.php

示例10: __construct

 /**
  * Constructor.
  *
  * @param KernelInterface  $kernel           A KernelInterface instance
  * @param EmbeddedComposer $embeddedComposer Composer Class Loader
  */
 public function __construct(KernelInterface $kernel, EmbeddedComposer $embeddedComposer)
 {
     $this->kernel = $kernel;
     $this->embeddedComposer = $embeddedComposer;
     if (function_exists('date_default_timezone_set') && function_exists('date_default_timezone_get')) {
         date_default_timezone_set(@date_default_timezone_get());
     }
     $version = $embeddedComposer->findPackage('sculpin/sculpin')->getPrettyVersion();
     if ($version !== Sculpin::GIT_VERSION && Sculpin::GIT_VERSION !== '@' . 'git_version' . '@') {
         $version .= ' (' . Sculpin::GIT_VERSION . ')';
     }
     parent::__construct('Sculpin', $version . ' - ' . $kernel->getName() . '/' . $kernel->getEnvironment() . ($kernel->isDebug() ? '/debug' : ''));
     $this->getDefinition()->addOption(new InputOption('--project-dir', null, InputOption::VALUE_REQUIRED, 'The project directory.', '.'));
     $this->getDefinition()->addOption(new InputOption('--env', '-e', InputOption::VALUE_REQUIRED, 'The Environment name.', $kernel->getEnvironment()));
     $this->getDefinition()->addOption(new InputOption('--no-debug', null, InputOption::VALUE_NONE, 'Switches off debug mode.'));
     $this->getDefinition()->addOption(new InputOption('--safe', null, InputOption::VALUE_NONE, 'Enable safe mode (no bundles loaded, no kernel booted)'));
     $this->getDefinition()->addOption(new InputOption('--git-version', null, InputOption::VALUE_NONE, 'See Git version'));
 }
开发者ID:georgjaehnig,项目名称:sculpin,代码行数:24,代码来源:Application.php

示例11: getTempKernel

    /**
     * @param KernelInterface $parent
     * @param string          $namespace
     * @param string          $parentClass
     * @param string          $warmupDir
     *
     * @return KernelInterface
     */
    protected function getTempKernel(KernelInterface $parent, $namespace, $parentClass, $warmupDir)
    {
        $rootDir = $parent->getRootDir();
        // 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 = substr($parent->getName(), 0, -1) . '_';
        $code = <<<EOF
<?php

namespace {$namespace}
{
    class {$class} extends {$parentClass}
    {
        public function getCacheDir()
        {
            return '{$warmupDir}';
        }

        public function getName()
        {
            return '{$name}';
        }

        public function getRootDir()
        {
            return '{$rootDir}';
        }
    }
}
EOF;
        $this->getContainer()->get('filesystem')->mkdir($warmupDir);
        file_put_contents($file = $warmupDir . '/kernel.tmp', $code);
        require_once $file;
        @unlink($file);
        $class = "{$namespace}\\{$class}";
        return new $class($parent->getEnvironment(), $parent->isDebug());
    }
开发者ID:ronaldlunaramos,项目名称:webstore,代码行数:47,代码来源:CacheClearCommand.php

示例12: 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());
    }
开发者ID:Milkyway2605,项目名称:EasyStage_Symfony,代码行数:71,代码来源:CacheClearCommand.php

示例13: getTempKernel

    protected function getTempKernel(KernelInterface $parent, $namespace, $class, $warmupDir)
    {
        $suffix = $this->getTempKernelSuffix();
        $rootDir = $parent->getRootDir();
        $code = <<<EOF
<?php

namespace {$namespace}
{
    class {$class}{$suffix} extends {$class}
    {
        public function getCacheDir()
        {
            return '{$warmupDir}';
        }

        public function getRootDir()
        {
            return '{$rootDir}';
        }

        protected function getContainerClass()
        {
            return parent::getContainerClass().'{$suffix}';
        }
    }
}
EOF;
        $this->getContainer()->get('filesystem')->mkdir($warmupDir);
        file_put_contents($file = $warmupDir . '/kernel.tmp', $code);
        require_once $file;
        @unlink($file);
        $class = "{$namespace}\\{$class}{$suffix}";
        return new $class($parent->getEnvironment(), $parent->isDebug());
    }
开发者ID:usefulthink,项目名称:symfony,代码行数:35,代码来源:CacheClearCommand.php

示例14: __construct

 /**
  * @param KernelInterface $kernel
  */
 public function __construct(KernelInterface $kernel)
 {
     $this->kernel = $kernel;
     $cacheScriptPath = $this->kernel->getCacheDir() . self::CACHE_SCRIPT_PATH;
     $this->configCache = new ConfigCache($cacheScriptPath, $this->kernel->isDebug());
 }
开发者ID:mb3rnard,项目名称:hateoas-bundle,代码行数:9,代码来源:RamlDocSymfonyCache.php

示例15: isDebug

 /**
  * {@inheritdoc}
  */
 public function isDebug()
 {
     return $this->kernel->isDebug();
 }
开发者ID:Maksold,项目名称:platform,代码行数:7,代码来源:KernelProxy.php


注:本文中的Symfony\Component\HttpKernel\KernelInterface::isDebug方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。