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


PHP Definition::getArgument方法代码示例

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


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

示例1: resolverContainsBufferHandler

 private function resolverContainsBufferHandler($expectedResolverIds)
 {
     $actualResolverIds = [];
     foreach ($this->closeBufferHandlersDefinition->getArgument(0) as $argument) {
         $this->assertInstanceOf('Symfony\\Component\\DependencyInjection\\Reference', $argument);
         $actualResolverIds[] = (string) $argument;
     }
     $this->assertEquals($expectedResolverIds, $actualResolverIds);
 }
开发者ID:cmodijk,项目名称:LongRunning,代码行数:9,代码来源:MonologCleanersPassBufferTest.php

示例2: getCompilerPass

 /**
  * @param Definition $resource
  *
  * @return CompilerPassInterface
  */
 private function getCompilerPass(Definition $resource)
 {
     $driver = $resource->getArgument(1);
     $path = $resource->getArgument(3);
     $format = $resource->getArgument(4);
     $model = $resource->getArgument(6);
     $class = $this->getCompilerPassClass($driver);
     $method = $this->getCompilerPassMethod($format);
     return $class::$method([$path => ClassUtils::getRealNamespace($model)], []);
 }
开发者ID:blazarecki,项目名称:lug,代码行数:15,代码来源:RegisterDriverMappingPass.php

示例3: assertDefinition

 /**
  * @param Definition $definition
  * @param string     $class
  * @param string     $repository
  */
 private function assertDefinition(Definition $definition, $class, $repository)
 {
     $this->assertSame($definition->getClass(), $repository);
     $factory = $definition->getFactory();
     $this->assertSame($factory[1], "getRepository");
     $this->assertSame($definition->getArgument(0), $class);
 }
开发者ID:itkg-canne,项目名称:open-orchestra-media-bundle,代码行数:12,代码来源:OpenOrchestraMediaModelExtensionTest.php

示例4: checkManager

 /**
  * Checks if manager definition has any filters set.
  *
  * @param Definition $filtersManager
  * @param string     $message
  *
  * @throws InvalidArgumentException
  */
 private function checkManager(Definition $filtersManager, $message = '')
 {
     $filtersContainer = $filtersManager->getArgument(0);
     if (!$filtersContainer->hasMethodCall('set')) {
         throw new InvalidArgumentException($message);
     }
 }
开发者ID:vinhdrt,项目名称:FilterManagerBundle,代码行数:15,代码来源:FilterPass.php

示例5: addDefinitionArguments

 /**
  * @param Definition $definition
  * @param stdClass $dependables
  */
 private function addDefinitionArguments(Definition $definition, stdClass $dependables)
 {
     $class = $definition->getClass();
     $dependables->references[$class] = array();
     for ($arg = 0; $arg < count($definition->getArguments()); $arg++) {
         $dependables->references[$class][$arg] = $definition->getArgument($arg);
     }
 }
开发者ID:qrz-io,项目名称:magento-symfony-container,代码行数:12,代码来源:InjectableCompilerPass.php

示例6: replaceArgument

 /**
  * @param ContainerBuilder $container
  * @param Definition       $definition
  * @param string           $tag
  * @param int              $argumentIndex
  */
 public function replaceArgument(ContainerBuilder $container, Definition $definition, $tag, $argumentIndex)
 {
     $transports = $definition->getArgument($argumentIndex);
     $taggedServices = $container->findTaggedServiceIds($tag);
     foreach ($taggedServices as $id => $attributes) {
         $transports[] = new Reference($id);
     }
     $definition->replaceArgument($argumentIndex, $transports);
 }
开发者ID:GerDner,项目名称:luck-docker,代码行数:15,代码来源:SynchronizerCompilerPass.php

示例7: getArgument

 /**
  * Gets an argument to pass to the service constructor/factory method.
  *
  * @param integer $index
  *
  * @return mixed The argument value
  *
  * @throws OutOfBoundsException When the argument does not exist
  *
  * @api
  * @since 4.0.0
  */
 public function getArgument($index)
 {
     try {
         $symfonyArgument = $this->_underlyingSymfonyDefinition->getArgument($index);
         return $this->convertToTubePressReferenceIfNecessary($symfonyArgument);
     } catch (\Symfony\Component\DependencyInjection\Exception\OutOfBoundsException $e) {
         throw new OutOfBoundsException($e);
     }
 }
开发者ID:tubepress,项目名称:tubepress,代码行数:21,代码来源:Definition.php

示例8: assertDefinition

 /**
  * @param Definition $definition
  * @param string     $class
  * @param string     $repository
  * @param bool       $filterType
  */
 private function assertDefinition(Definition $definition, $class, $repository, $filterType)
 {
     $this->assertSame($definition->getClass(), $repository);
     $factory = $definition->getFactory();
     $this->assertSame($factory[1], "getRepository");
     $this->assertSame($definition->getArgument(0), $class);
     if ($filterType) {
         $this->assertTrue($definition->hasMethodCall('setFilterTypeManager'));
     }
 }
开发者ID:open-orchestra,项目名称:open-orchestra-workflow-function-bundle,代码行数:16,代码来源:OpenOrchestraWorkflowFunctionModelExtensionTest.php

示例9: testProcessWithoutDefinition

 public function testProcessWithoutDefinition()
 {
     $pass = new AddDecoderPass();
     $definition = new Definition(null, array(null));
     $container = $this->prophesize(ContainerBuilder::class);
     $container->hasDefinition('brainbits.transcoder.decoder.resolver')->willReturn(false);
     $container->findTaggedServiceIds('transcoder.decoder')->shouldNotBeCalled();
     $container->getDefinition('brainbits.transcoder.decoder.resolver')->shouldNotBeCalled();
     $pass->process($container->reveal());
     $this->assertNull($definition->getArgument(0)[0]);
 }
开发者ID:brainbits,项目名称:transcoder-bundle,代码行数:11,代码来源:AddDecoderPassTest.php

示例10: evaluateArgumentValue

 private function evaluateArgumentValue(Definition $definition, $returnResult)
 {
     $actualValue = $definition->getArgument($this->argumentIndex);
     $constraint = new \PHPUnit_Framework_Constraint_IsEqual($this->expectedValue);
     if (!$constraint->evaluate($actualValue, '', true)) {
         if ($returnResult) {
             return false;
         }
         $this->fail($definition, sprintf('The value of argument with index %d (%s) is not equal to the expected value (%s)', $this->argumentIndex, $this->exporter->export($actualValue), $this->exporter->export($this->expectedValue)));
     }
     return true;
 }
开发者ID:kinkinweb,项目名称:lhvb,代码行数:12,代码来源:DefinitionHasArgumentConstraint.php

示例11: extractResourcesFilesFromSymfonyTranslator

 /**
  * @param Definition $symfonyTranslator
  *
  * @return array
  */
 private function extractResourcesFilesFromSymfonyTranslator(Definition $symfonyTranslator)
 {
     $options = $symfonyTranslator->getArgument(3);
     $languagesFiles = isset($options['resource_files']) ? $options['resource_files'] : [];
     $resourceFiles = [];
     foreach ($languagesFiles as $language => $files) {
         foreach ($files as $file) {
             $resourceFiles[] = $file;
         }
     }
     return $resourceFiles;
 }
开发者ID:ReissClothing,项目名称:Sylius,代码行数:17,代码来源:TranslatorResourceProviderPass.php

示例12: array

 function it_sets_services_to_array_of_controller_services_definitions(ContainerBuilder $container, Definition $definition1, Definition $definition2)
 {
     $container->findTaggedServiceIds(InjectableCompilerPass::TAG_NAME)->willReturn(['my.first.controller' => [InjectableCompilerPass::TAG_NAME], 'my.second.controller' => [InjectableCompilerPass::TAG_NAME]]);
     $controllersObject = (object) array('references' => array('My_First_Controller' => [0 => 'arg1', 1 => 'arg2'], 'My_Second_Controller' => [0 => 'arg1']));
     $definition1->getClass()->willReturn('My_First_Controller');
     $definition1->getArguments()->willReturn(['arg1', 'arg2']);
     $definition1->getArgument(0)->willReturn('arg1');
     $definition1->getArgument(1)->willReturn('arg2');
     $container->findDefinition('my.first.controller')->willReturn($definition1);
     $definition2->getClass()->willReturn('My_Second_Controller');
     $definition2->getArguments()->willReturn(['arg1']);
     $definition2->getArgument(0)->willReturn('arg1');
     $container->findDefinition('my.second.controller')->willReturn($definition2);
     $this->process($container);
     $container->set(InjectableCompilerPass::INJECTABLES_SERVICE_ID, $controllersObject)->shouldHaveBeenCalled();
 }
开发者ID:qrz-io,项目名称:magento-symfony-container,代码行数:16,代码来源:InjectableCompilerPassSpec.php

示例13: testProcess

 public function testProcess()
 {
     $container = new ContainerBuilder();
     $nonInterfaceListener = new NonInterfaceListener();
     $nonInterfaceListenerDefinition = new Definition(get_class($nonInterfaceListener));
     $nonInterfaceListenerDefinition->addTag('doctrine.event_listener');
     $nonInterfaceSubscriber = new NonInterfaceListener();
     $nonInterfaceSubscriberDefinition = new Definition(get_class($nonInterfaceSubscriber));
     $nonInterfaceSubscriberDefinition->addTag('doctrine.event_subscriber');
     $testListener = new TestListener();
     $testListenerDefinition = new Definition(get_class($testListener));
     $testListenerDefinition->addTag('doctrine.event_listener');
     $testSubscriber = new TestListener();
     $testSubscriberDefinition = new Definition(get_class($testSubscriber));
     $testSubscriberDefinition->addTag('doctrine.event_subscriber');
     $container->addDefinitions(['test.non_interface_listener' => $nonInterfaceListenerDefinition, 'test.non_interface_subscriber' => $nonInterfaceSubscriberDefinition, 'test.listener' => $testListenerDefinition, 'test.subscriber' => $testSubscriberDefinition]);
     $managerDefinition = new Definition();
     $managerDefinition->addArgument([]);
     $container->addDefinitions([OptionalListenersCompilerPass::OPTIONAL_LISTENER_MANAGER => $managerDefinition]);
     $compiler = new OptionalListenersCompilerPass();
     $compiler->process($container);
     $this->assertEquals(['test.listener', 'test.subscriber'], $managerDefinition->getArgument(0));
 }
开发者ID:Maksold,项目名称:platform,代码行数:23,代码来源:OptionalListenersCompilerPassTest.php

示例14: testProcess

 public function testProcess()
 {
     $container = new ContainerBuilder();
     $container->setParameter('ezpublish.config_resolver.updateable_services', array());
     $updateableServices = array();
     $def1Arg1 = 'foo';
     $def1Arg2 = new Reference('foo.bar');
     $def1 = new Definition('stdClass', array($def1Arg1, $def1Arg2));
     $def2 = new Definition('stdClass', array('$bar;some_namespace$', array()));
     $def3 = new Definition('stdClass', array('$content.default_ttl;ezsettings;ezdemo_site_admin$'));
     $def4 = new Definition('stdClass', array('$languages$'));
     $def5Arg1 = new Reference('def3');
     $def5 = new Definition('stdClass', array($def5Arg1));
     $def6Arg1 = new Reference('def1');
     $def6Arg2 = new Reference('def4');
     $def6 = new Definition('stdClass', array($def6Arg1, $def6Arg2));
     $def7MethodCalls = array(array('setFoo', array('something', new Reference('def1'))), array('setBar', array(array('baz'))));
     $def7 = new Definition('stdClass');
     $def7->setMethodCalls($def7MethodCalls);
     $def8MethodCalls = array(array('setFoo', array('$foo$')), array('setBar', array('$bar;baz$')));
     $def8 = new Definition('stdClass');
     $def8->setMethodCalls($def8MethodCalls);
     $container->setDefinitions(array('def1' => $def1, 'def2' => $def2, 'def3' => $def3, 'def4' => $def4, 'def5' => $def5, 'def6' => $def6, 'def7' => $def7, 'def8' => $def8));
     $configResolverPass = new ConfigResolverParameterPass(new DynamicSettingParser());
     $configResolverPass->process($container);
     // Ensure that non concerned services stayed untouched.
     self::assertSame($def1Arg1, $def1->getArgument(0));
     self::assertSame($def1Arg2, $def1->getArgument(1));
     self::assertSame($def1, $container->getDefinition('def1'));
     self::assertSame($def5Arg1, $def5->getArgument(0));
     self::assertSame($def5, $container->getDefinition('def5'));
     self::assertSame($def6Arg1, $def6->getArgument(0));
     self::assertSame($def6Arg2, $def6->getArgument(1));
     self::assertSame($def6, $container->getDefinition('def6'));
     self::assertSame($def7MethodCalls, $def7->getMethodCalls());
     self::assertSame($def7, $container->getDefinition('def7'));
     // Check that concerned services arguments have been correctly transformed.
     $def2arg1 = $def2->getArgument(0);
     self::assertInstanceOf('Symfony\\Component\\ExpressionLanguage\\Expression', $def2arg1);
     self::assertSame('service("ezpublish.config.resolver").getParameter("bar", "some_namespace", null)', (string) $def2arg1);
     // Also check 2nd argument
     self::assertSame(array(), $def2->getArgument(1));
     $def3arg1 = $def3->getArgument(0);
     self::assertInstanceOf('Symfony\\Component\\ExpressionLanguage\\Expression', $def3arg1);
     self::assertSame('service("ezpublish.config.resolver").getParameter("content.default_ttl", "ezsettings", "ezdemo_site_admin")', (string) $def3arg1);
     $def4arg1 = $def4->getArgument(0);
     self::assertInstanceOf('Symfony\\Component\\ExpressionLanguage\\Expression', $def4arg1);
     self::assertSame('service("ezpublish.config.resolver").getParameter("languages", null, null)', (string) $def4arg1);
     $def8Calls = $def8->getMethodCalls();
     self::assertSame(count($def8MethodCalls), count($def8Calls));
     self::assertSame($def8MethodCalls[0][0], $def8Calls[0][0]);
     self::assertInstanceOf('Symfony\\Component\\ExpressionLanguage\\Expression', $def8Calls[0][1][0]);
     $exprSetFoo = 'service("ezpublish.config.resolver").getParameter("foo", null, null)';
     self::assertSame($exprSetFoo, (string) $def8Calls[0][1][0]);
     self::assertSame($def8MethodCalls[1][0], $def8Calls[1][0]);
     self::assertInstanceOf('Symfony\\Component\\ExpressionLanguage\\Expression', $def8Calls[1][1][0]);
     $exprSetBar = 'service("ezpublish.config.resolver").getParameter("bar", "baz", null)';
     self::assertSame($exprSetBar, (string) $def8Calls[1][1][0]);
     $updateableServices['def8'] = array(array('setFoo', $exprSetFoo), array('setBar', $exprSetBar));
     self::assertTrue($container->hasParameter('ezpublish.config_resolver.resettable_services'));
     self::assertEquals(array('def2', 'def3', 'def4', 'def5', 'def6'), $container->getParameter('ezpublish.config_resolver.resettable_services'));
     self::assertEquals($updateableServices, $container->getParameter('ezpublish.config_resolver.updateable_services'));
 }
开发者ID:Heyfara,项目名称:ezpublish-kernel,代码行数:63,代码来源:ConfigResolverParameterPassTest.php

示例15: matchNames

 private function matchNames()
 {
     $spoolNames = array_keys($this->swiftMailerCleaner->getArgument(0));
     $transportNames = array_keys($this->swiftMailerCleaner->getArgument(1));
     $this->assertEquals($spoolNames, $transportNames);
 }
开发者ID:cmodijk,项目名称:LongRunning,代码行数:6,代码来源:SwiftMailerPassTest.php


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