當前位置: 首頁>>代碼示例>>PHP>>正文


PHP DefinitionDecorator::replaceArgument方法代碼示例

本文整理匯總了PHP中Symfony\Component\DependencyInjection\DefinitionDecorator::replaceArgument方法的典型用法代碼示例。如果您正苦於以下問題:PHP DefinitionDecorator::replaceArgument方法的具體用法?PHP DefinitionDecorator::replaceArgument怎麽用?PHP DefinitionDecorator::replaceArgument使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Symfony\Component\DependencyInjection\DefinitionDecorator的用法示例。


在下文中一共展示了DefinitionDecorator::replaceArgument方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: createConverter

 private function createConverter($name, array $config, ContainerBuilder $container)
 {
     $environment = new DefinitionDecorator($config['environment']);
     $environment->setPublic(false);
     $environment->setClass($container->getDefinition($config['environment'])->getClass());
     $environment->addMethodCall('mergeConfig', [$config['config']]);
     $environment->addTag('webuni_commonmark.environment.extensions', $config['extensions']);
     // $environment->addTag('webuni_commonmark.environment', ['parent' => $config['environment'], 'extensions' => [$config['extensions']]);
     $environmentName = 'webuni_commonmark.' . $name . '_environment' . $config['environment'];
     $container->setDefinition($environmentName, $environment);
     $parser = new DefinitionDecorator($config['parser']);
     $parser->setPublic(false);
     $parser->setClass($container->getDefinition($config['parser'])->getClass());
     $parser->replaceArgument(0, new Reference($environmentName));
     $renderer = new DefinitionDecorator($config['renderer']);
     $renderer->setPublic(false);
     $renderer->setClass($container->getDefinition($config['renderer'])->getClass());
     $renderer->replaceArgument(0, new Reference($environmentName));
     $converter = new DefinitionDecorator($config['converter']);
     $converter->setPublic(true);
     $converter->setClass($container->getDefinition($config['converter'])->getClass());
     $converter->replaceArgument(0, $parser);
     $converter->replaceArgument(1, $renderer);
     $converterName = 'webuni_commonmark.' . $name . '_converter';
     $container->setDefinition($converterName, $converter);
     return $converterName;
 }
開發者ID:colinodell,項目名稱:commonmark-bundle,代碼行數:27,代碼來源:WebuniCommonMarkExtension.php

示例2: create

    /**
     * {@inheritDoc}
     */
    public function create(ContainerBuilder $container, $resolverName, array $config)
    {
        $awsS3ClientId = 'liip_imagine.cache.resolver.'.$resolverName.'.client';
        $awsS3ClientDefinition = new Definition('Aws\S3\S3Client');
        if (method_exists($awsS3ClientDefinition, 'setFactory')) {
            $awsS3ClientDefinition->setFactory(array('Aws\S3\S3Client', 'factory'));
        } else {
            // to be removed when dependency on Symfony DependencyInjection is bumped to 2.6
            $awsS3ClientDefinition->setFactoryClass('Aws\S3\S3Client');
            $awsS3ClientDefinition->setFactoryMethod('factory');
        }
        $awsS3ClientDefinition->addArgument($config['client_config']);
        $container->setDefinition($awsS3ClientId, $awsS3ClientDefinition);

        $resolverDefinition = new DefinitionDecorator('liip_imagine.cache.resolver.prototype.aws_s3');
        $resolverDefinition->replaceArgument(0, new Reference($awsS3ClientId));
        $resolverDefinition->replaceArgument(1, $config['bucket']);
        $resolverDefinition->replaceArgument(2, $config['acl']);
        $resolverDefinition->replaceArgument(3, array_replace($config['url_options'], $config['get_options']));
        $resolverDefinition->replaceArgument(4, $config['put_options']);
        $resolverId = 'liip_imagine.cache.resolver.'.$resolverName;
        $container->setDefinition($resolverId, $resolverDefinition);

        if (isset($config['cache_prefix'])) {
            $resolverDefinition->addMethodCall('setCachePrefix', array($config['cache_prefix']));
        }

        if ($config['proxies']) {
            $proxiedResolverId = 'liip_imagine.cache.resolver.'.$resolverName.'.proxied';

            $container->setDefinition($proxiedResolverId, $resolverDefinition);

            $proxyResolverDefinition = new DefinitionDecorator('liip_imagine.cache.resolver.prototype.proxy');
            $proxyResolverDefinition->replaceArgument(0, new Reference($proxiedResolverId));
            $proxyResolverDefinition->replaceArgument(1, $config['proxies']);

            $container->setDefinition($resolverId, $proxyResolverDefinition);
        }

        if ($config['cache']) {
            $cachedResolverId = 'liip_imagine.cache.resolver.'.$resolverName.'.cached';

            $container->setDefinition($cachedResolverId, $container->getDefinition($resolverId));

            $cacheResolverDefinition = new DefinitionDecorator('liip_imagine.cache.resolver.prototype.cache');
            $cacheResolverDefinition->replaceArgument(0, new Reference($config['cache']));
            $cacheResolverDefinition->replaceArgument(1, new Reference($cachedResolverId));

            $container->setDefinition($resolverId, $cacheResolverDefinition);
        }

        $container->getDefinition($resolverId)->addTag('liip_imagine.cache.resolver', array(
            'resolver' => $resolverName,
        ));

        return $resolverId;
    }
開發者ID:networksoft,項目名稱:seekerplus.com,代碼行數:60,代碼來源:AwsS3ResolverFactory.php

示例3: addApis

 /**
  * {@inheritDoc}
  */
 protected function addApis(Definition $paymentDefinition, ContainerBuilder $container, $contextName, array $config)
 {
     $publishableKey = new DefinitionDecorator('payum.stripe.keys.prototype');
     $publishableKey->replaceArgument(0, $config['publishable_key']);
     $publishableKey->replaceArgument(1, $config['secret_key']);
     $publishableKey->setPublic(true);
     $publishableKeyId = 'payum.context.' . $contextName . '.keys';
     $container->setDefinition($publishableKeyId, $publishableKey);
     $paymentDefinition->addMethodCall('addApi', array(new Reference($publishableKeyId)));
 }
開發者ID:sanchojaf,項目名稱:oldmytriptocuba,代碼行數:13,代碼來源:StripeCheckoutPaymentFactory.php

示例4: createListener

 protected function createListener(ContainerBuilder $container, $id, $config, $userProvider)
 {
     $listenerId = 'security.authentication.listener.form';
     $listener = new DefinitionDecorator($listenerId);
     $listener->replaceArgument(4, $id);
     $listener->replaceArgument(5, $config);
     $listenerId .= '.' . $id;
     $container->setDefinition($listenerId, $listener);
     return $listenerId;
 }
開發者ID:beubi,項目名稱:FR3DLdapBundle,代碼行數:10,代碼來源:LdapFactory.php

示例5: create

 /**
  * {@inheritDoc}
  */
 public function create(ContainerBuilder $container, $loaderName, array $config)
 {
     $loaderDefinition = new DefinitionDecorator('liip_imagine.binary.loader.prototype.stream');
     $loaderDefinition->replaceArgument(0, $config['wrapper']);
     $loaderDefinition->replaceArgument(1, $config['context']);
     $loaderDefinition->addTag('liip_imagine.binary.loader', array('loader' => $loaderName));
     $loaderId = 'liip_imagine.binary.loader.' . $loaderName;
     $container->setDefinition($loaderId, $loaderDefinition);
     return $loaderId;
 }
開發者ID:sanchojaf,項目名稱:oldmytriptocuba,代碼行數:13,代碼來源:StreamLoaderFactory.php

示例6: create

 /**
  * {@inheritdoc}
  */
 public function create(ContainerBuilder $container, $resolverName, array $config)
 {
     $resolverDefinition = new DefinitionDecorator('liip_imagine.cache.resolver.prototype.web_path');
     $resolverDefinition->replaceArgument(2, $config['web_root']);
     $resolverDefinition->replaceArgument(3, $config['cache_prefix']);
     $resolverDefinition->addTag('liip_imagine.cache.resolver', array('resolver' => $resolverName));
     $resolverId = 'liip_imagine.cache.resolver.' . $resolverName;
     $container->setDefinition($resolverId, $resolverDefinition);
     return $resolverId;
 }
開發者ID:raphydev,項目名稱:onep,代碼行數:13,代碼來源:WebPathResolverFactory.php

示例7: addApis

 /**
  * {@inheritDoc}
  */
 protected function addApis(Definition $paymentDefinition, ContainerBuilder $container, $contextName, array $config)
 {
     $apiDefinition = new DefinitionDecorator('payum.authorize_net_aim.api.prototype');
     $apiDefinition->replaceArgument(0, $config['login_id']);
     $apiDefinition->replaceArgument(1, $config['transaction_key']);
     $apiDefinition->addMethodCall('setSandbox', array($config['sandbox']));
     $apiId = 'payum.context.' . $contextName . '.api';
     $container->setDefinition($apiId, $apiDefinition);
     $paymentDefinition->addMethodCall('addApi', array(new Reference($apiId)));
 }
開發者ID:sanchojaf,項目名稱:oldmytriptocuba,代碼行數:13,代碼來源:AuthorizeNetAimPaymentFactory.php

示例8: createStorage

 /**
  * {@inheritdoc}
  */
 protected function createStorage(ContainerBuilder $container, $modelClass, array $config)
 {
     $loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../../../Resources/config/storage'));
     $loader->load('filesystem.xml');
     $storage = new DefinitionDecorator('payum.storage.filesystem.prototype');
     $storage->setPublic(true);
     $storage->replaceArgument(0, $config['storage_dir']);
     $storage->replaceArgument(1, $modelClass);
     $storage->replaceArgument(2, $config['id_property']);
     return $storage;
 }
開發者ID:DocHoncho,項目名稱:PayumBundle,代碼行數:14,代碼來源:FilesystemStorageFactory.php

示例9: create

 /**
  * {@inheritdoc}
  */
 public function create(ContainerBuilder $container, $resolverName, array $config)
 {
     $resolverDefinition = new DefinitionDecorator('liip_imagine.cache.resolver.prototype.flysystem');
     $resolverDefinition->replaceArgument(0, new Reference($config['filesystem_service']));
     $resolverDefinition->replaceArgument(2, $config['root_url']);
     $resolverDefinition->replaceArgument(3, $config['cache_prefix']);
     $resolverDefinition->addTag('liip_imagine.cache.resolver', array('resolver' => $resolverName));
     $resolverId = 'liip_imagine.cache.resolver.' . $resolverName;
     $container->setDefinition($resolverId, $resolverDefinition);
     return $resolverId;
 }
開發者ID:aminin,項目名稱:LiipImagineBundle,代碼行數:14,代碼來源:FlysystemResolverFactory.php

示例10: createListener

 protected function createListener($container, $id, $config, $userProvider)
 {
     $listenerId = $this->getListenerId();
     $listener = new DefinitionDecorator($listenerId);
     $listener->replaceArgument(4, $id);
     $listener->replaceArgument(5, new Reference($this->createAuthenticationSuccessHandler($container, $id, $config)));
     $listener->replaceArgument(6, new Reference($this->createAuthenticationFailureHandler($container, $id, $config)));
     $listener->replaceArgument(8, array_intersect_key($config, $this->options));
     $listenerId .= '.' . $id;
     $container->setDefinition($listenerId, $listener);
     return $listenerId;
 }
開發者ID:proyecto404,項目名稱:GigyaBundle,代碼行數:12,代碼來源:GigyaFactory.php

示例11: createListener

 protected function createListener($container, $id, $config, $userProvider, $entryPoint)
 {
     $listenerId = 'security.authentication.listener.shibboleth';
     $listener = new DefinitionDecorator($listenerId);
     $listener->replaceArgument(3, $id);
     if ($entryPoint) {
         $listener->replaceArgument(4, new Reference($entryPoint));
     }
     $listenerId .= '.' . $id;
     $container->setDefinition($listenerId, $listener);
     return $listenerId;
 }
開發者ID:roenschg,項目名稱:ShibbolethBundle,代碼行數:12,代碼來源:ShibbolethFactory.php

示例12: process

 /**
  * @inheritdoc
  */
 public function process(ContainerBuilder $container)
 {
     $definitions = array();
     $servicesIds = $container->findTaggedServiceIds('pmd_state_machine.token_configurable');
     foreach ($servicesIds as $serviceId => $tag) {
         $group = isset($tag[0]['group']) ? $tag[0]['group'] : null;
         $type = isset($tag[0]['type']) ? $tag[0]['type'] : null;
         if (!isset($group) || !isset($type)) {
             throw new \InvalidArgumentException(sprintf('Services tagged %s must have group and type defined', 'pmd_state_machine.token_configurable'));
         }
         $serviceDefinition = $container->getDefinition($serviceId);
         $optionsId = sprintf('pmd_state_machine.behavior.%s_%s_options', $group, $type);
         $optionsReference = new Reference($optionsId, ContainerInterface::NULL_ON_INVALID_REFERENCE);
         // Configure options resolver
         $resolverId = sprintf('pmd_state_machine.behavior.%s_%s_resolver', $group, $type);
         $resolverReference = new Reference($resolverId);
         $resolverDefinition = new DefinitionDecorator('pmd_state_machine.behavior_resolver.token_options_resolver');
         $resolverDefinition->replaceArgument(0, $optionsReference);
         // Configure configurable decorator
         $configId = sprintf('pmd_state_machine.behavior.%s_%s_configurator', $group, $type);
         $configDefinition = new DefinitionDecorator('pmd_state_machine.behavior.token_configurable_configurator');
         $configDefinition->replaceArgument(0, $resolverReference);
         $serviceDefinition->setConfigurator(array(new Reference($configId, ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE, false), 'configure'));
         $definitions[$resolverId] = $resolverDefinition;
         $definitions[$configId] = $configDefinition;
     }
     $container->addDefinitions($definitions);
 }
開發者ID:piotrminkina,項目名稱:pmd,代碼行數:31,代碼來源:TokenConfigurablePass.php

示例13: process

 /**
  * @param ContainerBuilder $container
  *
  * @throws \InvalidArgumentException
  */
 public function process(ContainerBuilder $container)
 {
     $config = $container->getExtensionConfig('elastica')[0];
     $jsonLdFrameLoader = $container->get('nemrod.elastica.jsonld.frame.loader.filesystem');
     $confManager = $container->getDefinition('nemrod.elastica.config_manager');
     $filiationBuilder = $container->get('nemrod.filiation.builder');
     $jsonLdFrameLoader->setFiliationBuilder($filiationBuilder);
     foreach ($config['indexes'] as $name => $index) {
         $indexName = isset($index['index_name']) ? $index['index_name'] : $name;
         foreach ($index['types'] as $typeName => $settings) {
             $jsonLdFrameLoader->setEsIndex($name);
             $frame = $jsonLdFrameLoader->load($settings['frame'], null, true, true, true);
             $type = !empty($frame['@type']) ? $frame['@type'] : $settings['type'];
             if (empty($type)) {
                 throw \Exception("You must provide a RDF Type.");
             }
             //type
             $typeId = 'nemrod.elastica.type.' . $name . '.' . $typeName;
             $indexId = 'nemrod.elastica.index.' . $name;
             $typeDef = new DefinitionDecorator('nemrod.elastica.type.abstract');
             $typeDef->replaceArgument(0, $type);
             $typeDef->setFactory(array(new Reference($indexId), 'getType'));
             $typeDef->addTag('nemrod.elastica.type', array('index' => $name, 'name' => $typeName, 'type' => $type));
             $container->setDefinition($typeId, $typeDef);
             //registering config to configManager
             $confManager->addMethodCall('setTypeConfigurationArray', array($name, $typeName, $type, $frame));
         }
     }
 }
開發者ID:conjecto,項目名稱:nemrod,代碼行數:34,代碼來源:ElasticaFramingRegistrationPass.php

示例14: process

 /**
  * {@inheritDoc}
  */
 public function process(ContainerBuilder $container)
 {
     foreach ($container->findTaggedServiceIds('payum.storage_extension') as $id => $tagAttributes) {
         foreach ($tagAttributes as $attributes) {
             $paymentIds = array();
             if (isset($attributes['all']) && $attributes['all']) {
                 $paymentIds = array_merge($paymentIds, $this->findAllPaymentIds($container));
             }
             if (isset($attributes['factory']) && $attributes['factory']) {
                 $paymentIds = array_merge($paymentIds, $this->findPaymentIdsByFactory($container, $attributes['factory']));
             }
             if (isset($attributes['context']) && $attributes['context']) {
                 $paymentIds = array_merge($paymentIds, $this->findPaymentIdsByContext($container, $attributes['context']));
             }
             $paymentIds = array_filter(array_unique($paymentIds));
             foreach ($paymentIds as $paymentId) {
                 $storageExtension = new DefinitionDecorator('payum.extension.storage.prototype');
                 $storageExtension->replaceArgument(0, new Reference($id));
                 $storageExtension->setPublic(false);
                 if (false !== strpos($id, '.storage.')) {
                     $storageExtensionId = str_replace('.storage.', '.extension.storage.', $id);
                 } else {
                     throw new LogicException(sprintf('In order to add storage to extension the storage %id has to contains ".storage." inside.', $id));
                 }
                 $container->setDefinition($storageExtensionId, $storageExtension);
                 $payment = $container->getDefinition($paymentId);
                 $payment->addMethodCall('addExtension', array(new Reference($storageExtensionId), isset($attributes['prepend']) && $attributes['prepend']));
             }
         }
     }
 }
開發者ID:sanchojaf,項目名稱:oldmytriptocuba,代碼行數:34,代碼來源:PayumStorageExtensionsPass.php

示例15: process

 /**
  * @inheritdoc
  */
 public function process(ContainerBuilder $container)
 {
     if (!$container->hasDefinition('qimnet.crud.configuration.repository')) {
         return;
     }
     $repository = $container->getDefinition('qimnet.crud.configuration.repository');
     $defaults = $container->getParameter('qimnet.crud.defaults');
     foreach ($container->getParameter('qimnet.crud.services') as $name => $configuration) {
         $options = $configuration['options'] + array('name' => $name) + $defaults['options'];
         $configuration = $configuration + $defaults;
         $serviceId = 'qimnet.crud.configuration.' . strtolower($name);
         $definition = new DefinitionDecorator('qimnet.crud.configuration');
         foreach (array('object_manager_factory', 'security_context_factory', 'path_generator_factory') as $index => $key) {
             if ($configuration[$key]) {
                 $definition->replaceArgument($index, new Reference($configuration[$key]));
             }
         }
         $definition->addArgument($options);
         if ($configuration['class']) {
             $definition->setClass($configuration['class']);
         }
         $definition->addTag('qimnet.crud.configuration', array('alias' => $name, 'object_class' => $options['object_class'], 'worker' => $configuration['worker'], 'redirection_manager' => $configuration['redirection_manager']));
         $container->setDefinition($serviceId, $definition);
     }
     $taggedServices = $container->findTaggedServiceIds('qimnet.crud.configuration');
     foreach ($taggedServices as $id => $attributes) {
         $repository->addMethodCall('add', array($attributes[0]['alias'], $attributes[0]['object_class'], $id, $attributes[0]['worker'], $attributes[0]['redirection_manager']));
     }
 }
開發者ID:qimnet,項目名稱:crud-bundle,代碼行數:32,代碼來源:CRUDConfigurationCompilerPass.php


注:本文中的Symfony\Component\DependencyInjection\DefinitionDecorator::replaceArgument方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。