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


PHP ContainerBuilder::expand方法代码示例

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


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

示例1: setupCache

 private function setupCache(ContainerBuilder $container)
 {
     $container->addDefinition($this->prefix('cacheJournal'))->setClass('Nette\\Caching\\Storages\\FileJournal', array($container->expand('%tempDir%')));
     $container->addDefinition('cacheStorage')->setClass('Nette\\Caching\\Storages\\FileStorage', array($container->expand('%tempDir%/cache')));
     $container->addDefinition($this->prefix('templateCacheStorage'))->setClass('Nette\\Caching\\Storages\\PhpFileStorage', array($container->expand('%tempDir%/cache')))->setAutowired(FALSE);
     $container->addDefinition($this->prefix('cache'))->setClass('Nette\\Caching\\Cache', array(1 => $container::literal('$namespace')))->addSetup('::trigger_error', array('Service cache is deprecated.', E_USER_DEPRECATED))->setParameters(array('namespace' => NULL));
 }
开发者ID:jurasm2,项目名称:nette,代码行数:7,代码来源:NetteExtension.php

示例2: setupTemplating

 /**
  * @param \Nette\DI\ContainerBuilder $container
  * @param array $config
  */
 private function setupTemplating(ContainerBuilder $container, array $config)
 {
     $def = $container->addDefinition($this->prefix('templateFilesFormatter'))->setClass('Lohini\\Templating\\TemplateFilesFormatter')->addSetup('$skin', [$config['skin']]);
     foreach ($config['dirs'] as $dir => $priority) {
         $def->addSetup('addDir', Validators::isNumericInt($dir) ? [$priority] : [$container->expand($dir), $priority]);
     }
 }
开发者ID:lohini,项目名称:framework,代码行数:11,代码来源:LohiniExtension.php

示例3: processExtensions

 public function processExtensions()
 {
     for ($i = 0; $slice = array_slice($this->extensions, $i, 1, TRUE); $i++) {
         $name = key($slice);
         if (isset($this->config[$name])) {
             $this->config[$name] = $this->builder->expand($this->config[$name]);
         }
         $this->extensions[$name]->loadConfiguration();
     }
     if ($extra = array_diff_key($this->config, self::$reserved, $this->extensions)) {
         $extra = implode("', '", array_keys($extra));
         throw new Nette\InvalidStateException("Found sections '{$extra}' in configuration, but corresponding extensions are missing.");
     }
 }
开发者ID:cujan,项目名称:atlashornin,代码行数:14,代码来源:Compiler.php

示例4: setupSystemApplication

 public function setupSystemApplication(ContainerBuilder $container, array $config)
 {
     $container->addDefinition($this->prefix('system.application.mailerFormFactory'))->setClass('Venne\\System\\AdminModule\\MailerFormFactory', array(new Statement('@system.admin.configFormFactory', array($container->expand('%configDir%/config.neon'), ''))));
     $container->addDefinition($this->prefix('system.application.systemFormFactory'))->setClass('Venne\\System\\AdminModule\\AdministrationFormFactory', array(new Statement('@system.admin.configFormFactory', array($container->expand('%configDir%/config.neon'), 'system.administration'))));
     $container->addDefinition($this->prefix('system.application.applicationFormFactory'))->setClass('Venne\\System\\AdminModule\\ApplicationFormFactory', array(new Statement('@system.admin.configFormFactory', array($container->expand('%configDir%/config.neon'), ''))));
     $container->addDefinition($this->prefix('system.applicationPresenter'))->setClass('Venne\\System\\AdminModule\\ApplicationPresenter')->addTag(static::TAG_ADMINISTRATION, array('link' => 'Admin:System:Application:', 'category' => 'System', 'name' => 'System settings', 'description' => 'Set up database, environment,...', 'priority' => 15));
 }
开发者ID:venne,项目名称:venne,代码行数:7,代码来源:SystemExtension.php

示例5: setupLatte

 private function setupLatte(ContainerBuilder $container, array $config)
 {
     $this->validate($config, $this->defaults['latte'], 'nette.latte');
     $latteFactory = $container->addDefinition($this->prefix('latteFactory'))->setClass('Latte\\Engine')->addSetup('setTempDirectory', array($container->expand('%tempDir%/cache/latte')))->addSetup('setAutoRefresh', array($container->parameters['debugMode']))->addSetup('setContentType', array($config['xhtml'] ? Latte\Compiler::CONTENT_XHTML : Latte\Compiler::CONTENT_HTML))->setImplement('Nette\\Bridges\\ApplicationLatte\\ILatteFactory');
     $container->addDefinition($this->prefix('templateFactory'))->setClass('Nette\\Bridges\\ApplicationLatte\\TemplateFactory');
     $latte = $container->addDefinition($this->prefix('latte'))->setClass('Latte\\Engine')->addSetup('setTempDirectory', array($container->expand('%tempDir%/cache/latte')))->addSetup('setAutoRefresh', array($container->parameters['debugMode']))->addSetup('setContentType', array($config['xhtml'] ? Latte\Compiler::CONTENT_XHTML : Latte\Compiler::CONTENT_HTML))->setAutowired(FALSE);
     foreach ($config['macros'] as $macro) {
         if (strpos($macro, '::') === FALSE && class_exists($macro)) {
             $macro .= '::install';
         } else {
             Validators::assert($macro, 'callable');
         }
         $latte->addSetup('?->onCompile[] = function($engine) { ' . $macro . '($engine->getCompiler()); }', array('@self'));
         $latteFactory->addSetup('?->onCompile[] = function($engine) { ' . $macro . '($engine->getCompiler()); }', array('@self'));
     }
     if (class_exists('Nette\\Templating\\FileTemplate')) {
         $container->addDefinition($this->prefix('template'))->setClass('Nette\\Templating\\FileTemplate')->addSetup('registerFilter', array(new Nette\DI\Statement(array($latteFactory, 'create'))))->addSetup('registerHelperLoader', array('Nette\\Templating\\Helpers::loader'))->setAutowired(FALSE);
     }
 }
开发者ID:petrparolek,项目名称:web_cms,代码行数:19,代码来源:NetteExtension.php

示例6: autowireEvents

 /**
  * @param \Nette\DI\ContainerBuilder $builder
  */
 private function autowireEvents(Nette\DI\ContainerBuilder $builder)
 {
     foreach ($builder->getDefinitions() as $def) {
         /** @var Nette\DI\ServiceDefinition $def */
         if ($this->isAlias($def)) {
             continue;
             // alias
         }
         if (!class_exists($class = $builder->expand($def->class))) {
             if (!$def->factory) {
                 continue;
             } elseif (is_array($class = $builder->expand($def->factory->entity))) {
                 continue;
             } elseif (!class_exists($class)) {
                 continue;
             }
         }
         if ($def->getImplementType() === 'get') {
             continue;
         }
         $this->bindEventProperties($def, Nette\Reflection\ClassType::from($class));
     }
 }
开发者ID:hranicka,项目名称:kdyby-events,代码行数:26,代码来源:EventsExtension.php

示例7: autowireEvents

 /**
  * @param \Nette\DI\ContainerBuilder $builder
  */
 private function autowireEvents(Nette\DI\ContainerBuilder $builder)
 {
     $newApi = defined('Nette\\DI\\ServiceDefinition::IMPLEMENT_MODE_GET');
     //new in Nette 2.4
     foreach ($builder->getDefinitions() as $def) {
         /** @var Nette\DI\ServiceDefinition $def */
         if ($this->isAlias($def)) {
             continue;
             // alias
         }
         if (!class_exists($class = $builder->expand($def->getClass()))) {
             if (!$def->getFactory()) {
                 continue;
             } elseif (is_array($class = $builder->expand($def->getEntity()))) {
                 continue;
             } elseif (!class_exists($class)) {
                 continue;
             }
         }
         if ($newApi ? $def->getImplementMode() === $def::IMPLEMENT_MODE_GET : $def->getImplementType() === 'get') {
             continue;
         }
         $this->bindEventProperties($def, Nette\Reflection\ClassType::from($class));
     }
 }
开发者ID:LidskaSila,项目名称:kdyby-events,代码行数:28,代码来源:EventsExtension.php

示例8: doSerializeValueResolve

 private function doSerializeValueResolve(ContainerBuilder $builder, $expression)
 {
     if ($expression instanceof Code\PhpLiteral) {
         $expression = self::resolveExpression($expression);
     } elseif (substr($expression, 0, 1) === '%') {
         $expression = $builder->expand($expression);
     } elseif (substr($expression, 0, 1) === '$') {
         $expression = new Code\PhpLiteral($expression);
     } else {
         if (!($m = self::shiftAccessPath($expression))) {
             return $expression;
             // it's probably some kind of expression
         } else {
             if ($m['context'] === 'this') {
                 $targetObject = '$this';
             } elseif ($m['context'] === 'context' && ($p = self::shiftAccessPath($m['path']))) {
                 if (class_exists($p['context']) || interface_exists($p['context'])) {
                     $targetObject = Code\Helpers::format('$this->_kdyby_aopContainer->getByType(?)', $p['context']);
                 } else {
                     $targetObject = Code\Helpers::format('$this->_kdyby_aopContainer->getService(?)', $p['context']);
                 }
                 $m['path'] = $p['path'];
             } else {
                 throw new Kdyby\Aop\NotImplementedException();
             }
             $expression = Code\Helpers::format('PropertyAccess::createPropertyAccessor()->getValue(?, ?)', new Code\PhpLiteral($targetObject), $m['path']);
         }
         $expression = new Code\PhpLiteral($expression);
     }
     return $expression;
 }
开发者ID:kdyby,项目名称:aop,代码行数:31,代码来源:Criteria.php

示例9: setupLatte

 private function setupLatte(ContainerBuilder $container, array $config)
 {
     $this->validate($config, $this->defaults['latte'], 'nette.latte');
     $latteFactory = $container->addDefinition($this->prefix('latteFactory'))->setClass('Latte\\Engine')->addSetup('setTempDirectory', array($container->expand('%tempDir%/cache/latte')))->addSetup('setAutoRefresh', array($container->parameters['debugMode']))->addSetup('setContentType', array($config['xhtml'] ? Latte\Compiler::CONTENT_XHTML : Latte\Compiler::CONTENT_HTML))->setImplement('Nette\\Bridges\\Framework\\ILatteFactory');
     $container->addDefinition($this->prefix('templateFactory'))->setClass('Nette\\Bridges\\ApplicationLatte\\TemplateFactory');
     $container->addDefinition($this->prefix('latte'))->setClass('Latte\\Engine')->addSetup('::trigger_error', array('Service nette.template is deprecated.', E_USER_DEPRECATED))->addSetup('setTempDirectory', array($container->expand('%tempDir%/cache/latte')))->addSetup('setAutoRefresh', array($container->parameters['debugMode']))->addSetup('setContentType', array($config['xhtml'] ? Latte\Compiler::CONTENT_XHTML : Latte\Compiler::CONTENT_HTML))->setAutowired(FALSE);
     $container->addDefinition($this->prefix('template'))->setClass('Nette\\Templating\\FileTemplate')->addSetup('::trigger_error', array('Service nette.template is deprecated.', E_USER_DEPRECATED))->addSetup('registerFilter', array(new Nette\DI\Statement(array($latteFactory, 'create'))))->addSetup('registerHelperLoader', array('Nette\\Templating\\Helpers::loader'))->setAutowired(FALSE);
 }
开发者ID:hrach,项目名称:nette,代码行数:8,代码来源:NetteExtension.php

示例10: afterCompile

 function afterCompile(ContainerBuilder $container, Nette\Utils\PhpGenerator\ClassType $class)
 {
     $initialize = $class->methods['initialize'];
     if (isset($container->parameters['tempDir'])) {
         $initialize->addBody($this->checkTempDir($container->expand($container->parameters['tempDir'])));
     }
     foreach ($container->findByTag('run') as $name => $foo) {
         $initialize->addBody('$this->getService(?);', array($name));
     }
 }
开发者ID:skapytek,项目名称:scripts,代码行数:10,代码来源:nette.min.php


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