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


PHP ContainerBuilder::isFrozen方法代码示例

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


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

示例1: set

 /**
  * @param string $id
  * @param mixed  $service
  */
 public static function set($id, $service)
 {
     if (self::$container === null || self::$container->isFrozen()) {
         self::load();
     }
     self::$container->set($id, $service);
     $definition = new Definition(get_class($service));
     self::$container->setDefinition($id, $definition);
 }
开发者ID:wadify,项目名称:wadify-sdk-php,代码行数:13,代码来源:Container.php

示例2: runCommand

 /**
  * Runs a command and returns the exit status.
  *
  * If an output manager is not provided, a new one will be created. The
  * new output stream will use a memory stream, and the instance will be
  * set as the `$output` argument by reference.
  *
  * @param InputInterface  $input   The input manager.
  * @param OutputInterface &$output The output manager.
  *
  * @return integer The exit status.
  */
 public function runCommand(InputInterface $input = null, OutputInterface &$output = null)
 {
     if ($this->container instanceof ContainerBuilder && !$this->container->isFrozen()) {
         $this->container->compile();
     }
     if (null === $output) {
         $output = new StreamOutput(fopen('php://memory', 'r+'));
     }
     return $this->application->run($input, $output);
 }
开发者ID:bangpound,项目名称:console,代码行数:22,代码来源:CommandTestCase.php

示例3: dump

 public function dump(array $options = array())
 {
     $this->reflectionObject = new ReflectionObject($this);
     $options = array_merge(array('class' => 'ProjectServiceContainer', 'base_class' => '\\Nucleus\\DependencyInjection\\BaseServiceContainer', 'namespace' => ''), $options);
     $code = $this->call('startClass', $options['class'], $options['base_class'], $options['namespace']);
     $code .= $this->addCustom($options);
     if ($this->container->isFrozen()) {
         $code .= $this->call('addFrozenConstructor');
     } else {
         $code .= $this->call('addConstructor');
     }
     $code .= $this->call('addServices') . $this->call('addDefaultParametersMethod') . $this->call('endClass') . $this->call('addProxyClasses');
     return $code;
 }
开发者ID:mpoiriert,项目名称:nucleus,代码行数:14,代码来源:PhpDumper.php

示例4: getService

 /**
  * @param $id The service id
  * @return object
  */
 private function getService($id)
 {
     if (!$this->serviceContainer->isFrozen()) {
         throw new \RuntimeException(sprintf('The Service "%s" can not be accessed. Maybe you forgot to call the "build" method?', $id));
     }
     return $this->serviceContainer->get($id);
 }
开发者ID:neoxygen,项目名称:neogen,代码行数:11,代码来源:Neogen.php

示例5: getService

 private function getService($name)
 {
     if (!$this->serviceContainer->isFrozen()) {
         throw new \RuntimeException(sprintf('The service with ID "%s" cannot be accessed before the application is built'));
     }
     if (!$this->serviceContainer->has($name)) {
         throw new \RuntimeException(sprintf('The service with ID "%s" is not registered'));
     }
     return $this->serviceContainer->get($name);
 }
开发者ID:ikwattro,项目名称:github-event,代码行数:10,代码来源:EventHandler.php

示例6: __construct

    /**
     * {@inheritdoc}
     */
    public function __construct(ContainerBuilder $container)
    {
        if (!$container->isFrozen()) {
            @trigger_error('Dumping an uncompiled ContainerBuilder is deprecated since version 3.3 and will not be supported anymore in 4.0. Compile the container beforehand.', E_USER_DEPRECATED);
        }

        parent::__construct($container);

        $this->inlinedDefinitions = new \SplObjectStorage();
    }
开发者ID:symfony,项目名称:symfony,代码行数:13,代码来源:PhpDumper.php

示例7: testGetParameters

 /**
  * Tests that parameter processing works properly.
  *
  * @covers ::getParameters
  * @covers ::prepareParameters
  * @covers ::escape
  * @covers ::dumpValue
  * @covers ::getReferenceCall
  *
  * @dataProvider getParametersDataProvider
  */
 public function testGetParameters($parameters, $definition_parameters, $is_frozen)
 {
     $this->containerDefinition['parameters'] = $definition_parameters;
     $this->containerDefinition['frozen'] = $is_frozen;
     $parameter_bag = new ParameterBag($parameters);
     $this->containerBuilder->getParameterBag()->willReturn($parameter_bag);
     $this->containerBuilder->isFrozen()->willReturn($is_frozen);
     if (isset($parameters['reference'])) {
         $definition = new Definition('\\stdClass');
         $this->containerBuilder->getDefinition('referenced_service')->willReturn($definition);
     }
     $this->assertEquals($this->containerDefinition, $this->dumper->getArray(), 'Expected definition matches dump.');
 }
开发者ID:318io,项目名称:318-io,代码行数:24,代码来源:OptimizedPhpArrayDumperTest.php

示例8: doRun

 public function doRun(InputInterface $input, OutputInterface $output)
 {
     if (!$this->container->isFrozen()) {
         $this->loadConfigurationFile($input);
         $this->registerExtensions();
         $this->container->compile();
         $eventDispatcher = $this->container->get('event_dispatcher');
         if ($eventDispatcher instanceof ContainerAwareEventDispatcher) {
             $this->setDispatcher($eventDispatcher);
         }
         $this->registerCommands();
         if (true === $input->hasParameterOption(array('--shell', '-s'))) {
             $shell = new Shell($this);
             $shell->run();
             return 0;
         }
     }
     if (true === $input->hasParameterOption(array('--init'))) {
         $this->add($this->container->get('phpzone.phpzone.console.command.init'));
         $input = new ArrayInput(array('command' => 'phpzone:init'));
     }
     return parent::doRun($input, $output);
 }
开发者ID:phpzone,项目名称:phpzone,代码行数:23,代码来源:Application.php

示例9: getContainer

 /**
  * Returns ContainerBuilder by including the default file 'containerBuilder.php' from settings directory.
  *
  * @throws \RuntimeException
  */
 protected function getContainer()
 {
     if ($this->innerContainer instanceof ContainerInterface) {
         // Do nothing
     } elseif (!is_readable($this->innerContainer)) {
         throw new RuntimeException(sprintf("Unable to read file %s\n", $this->innerContainer));
     } else {
         // 'containerBuilder.php' file expects $installDir variable to be set by caller
         $installDir = $this->installDir;
         $this->innerContainer = (require_once $this->innerContainer);
     }
     // Compile container if necessary
     if ($this->innerContainer instanceof ContainerBuilder && !$this->innerContainer->isFrozen()) {
         $this->innerContainer->compile();
     }
 }
开发者ID:Pixy,项目名称:ezpublish-kernel,代码行数:21,代码来源:ServiceContainer.php

示例10: isFrozen

 public function isFrozen()
 {
     return $this->delegate->isFrozen();
 }
开发者ID:planetenkiller,项目名称:core,代码行数:4,代码来源:SandboxContainerBuilder.php


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