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


PHP DefinitionDecorator::setPublic方法代碼示例

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


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

示例1: registerMiddleware

 /**
  * Sets up handlers and registers middleware for each tagged client.
  *
  * @param ContainerBuilder $container
  * @param array            $middlewareBag
  */
 private function registerMiddleware(ContainerBuilder $container, array $middlewareBag)
 {
     $clients = $container->findTaggedServiceIds(self::CLIENT_TAG);
     foreach ($clients as $clientId => $tags) {
         if (count($tags) > 1) {
             throw new \LogicException('Clients should use a single \'csa_guzzle.client\' tag');
         }
         $clientMiddleware = $middlewareBag;
         if (isset($tags[0]['middleware'])) {
             $whitelist = explode(' ', $tags[0]['middleware']);
             $clientMiddleware = array_filter($clientMiddleware, function ($value) use($whitelist) {
                 return in_array($value['alias'], $whitelist, true);
             });
         }
         $handlerStack = new DefinitionDecorator('csa_guzzle.handler_stack');
         $handlerStack->setPublic(false);
         foreach ($clientMiddleware as $middleware) {
             $handlerStack->addMethodCall('push', [new Reference($middleware['id']), $middleware['alias']]);
         }
         $clientHandlerStackId = sprintf('csa_guzzle.handler_stack.%s', $clientId);
         $container->setDefinition($clientHandlerStackId, $handlerStack);
         $clientDefinition = $container->findDefinition($clientId);
         $arguments = $clientDefinition->getArguments();
         $options = [];
         if (!empty($arguments)) {
             $options = array_shift($arguments);
         }
         $options['handler'] = new Reference($clientHandlerStackId);
         array_unshift($arguments, $options);
         $clientDefinition->setArguments($arguments);
     }
 }
開發者ID:Tobion,項目名稱:CsaGuzzleBundle,代碼行數:38,代碼來源:MiddlewarePass.php

示例2: process

 public function process(ContainerBuilder $container)
 {
     if (!($container->hasDefinition('fragment.listener') && $container->hasDefinition('ezpublish.decorated_fragment_renderer'))) {
         return null;
     }
     $fragmentListenerDef = $container->findDefinition('fragment.listener');
     $fragmentListenerDef->setFactoryService('ezpublish.fragment_listener.factory')->setFactoryMethod('buildFragmentListener')->addArgument('%fragment.listener.class%');
     // Looping over all fragment renderers to decorate them
     // This is to make sure they are siteaccess aware (siteaccess is serialized in rendered path).
     foreach ($container->findTaggedServiceIds('kernel.fragment_renderer') as $id => $attributes) {
         $renamedId = "{$id}.inner";
         $definition = $container->getDefinition($id);
         $public = $definition->isPublic();
         $tags = $definition->getTags();
         $definition->setPublic(false);
         $container->setDefinition($renamedId, $definition);
         $decoratedDef = new DefinitionDecorator('ezpublish.decorated_fragment_renderer');
         $decoratedDef->setArguments(array(new Reference($renamedId)));
         $decoratedDef->setPublic($public);
         $decoratedDef->setTags($tags);
         // Special treatment for inline fragment renderer, to fit ESI renderer constructor type hinting (forced to InlineFragmentRenderer)
         if ($id === 'fragment.renderer.inline') {
             $decoratedDef->setClass($container->getParameter('ezpublish.decorated_fragment_renderer.inline.class'));
         }
         $container->setDefinition($id, $decoratedDef);
     }
 }
開發者ID:dfritschy,項目名稱:ezpublish-kernel,代碼行數:27,代碼來源:FragmentPass.php

示例3: createPackageDefinition

 /**
  * Returns a definition for an asset package.
  *
  * @param ContainerBuilder $container   Container
  * @param array            $httpUrls    SSL assets_base_urls
  * @param array            $sslUrls     assets_base_urls
  * @param string           $rootDir     Directory where to look for reved assets
  * @param string           $summaryFile Grunt filerev summary file
  * @param string           $cacheDir    Kernel cache dir
  * @param bool             $debug       Debug mode?
  * @param string           $name        Package name
  *
  * @return DefinitionDecorator
  */
 private function createPackageDefinition(ContainerBuilder $container, array $httpUrls, array $sslUrls, $rootDir, $summaryFile, $cacheDir, $debug, $name = null)
 {
     if (!$httpUrls) {
         $package = new DefinitionDecorator('grunt.filerev.templating.asset.path_package');
         $package->setPublic(false)->setScope('request')->replaceArgument(1, $rootDir)->replaceArgument(2, $summaryFile)->replaceArgument(3, $cacheDir)->replaceArgument(4, $debug);
         return $package;
     }
     if ($httpUrls == $sslUrls) {
         $package = new DefinitionDecorator('grunt.filerev.templating.asset.url_package');
         $package->setPublic(false)->replaceArgument(0, $sslUrls)->replaceArgument(1, $rootDir)->replaceArgument(2, $summaryFile)->replaceArgument(3, $cacheDir)->replaceArgument(4, $debug);
         return $package;
     }
     $prefix = $name ? 'templating.asset.package.' . $name : 'templating.asset.default_package';
     $httpPackage = new DefinitionDecorator('grunt.filerev.templating.asset.url_package');
     $httpPackage->replaceArgument(0, $httpUrls)->replaceArgument(1, $rootDir)->replaceArgument(2, $summaryFile)->replaceArgument(3, $cacheDir)->replaceArgument(4, $debug);
     $container->setDefinition($prefix . '.http', $httpPackage);
     if ($sslUrls) {
         $sslPackage = new DefinitionDecorator('grunt.filerev.templating.asset.url_package');
         $sslPackage->replaceArgument(0, $sslUrls)->replaceArgument(1, $rootDir)->replaceArgument(2, $summaryFile)->replaceArgument(3, $cacheDir)->replaceArgument(4, $debug);
     } else {
         $sslPackage = new DefinitionDecorator('grunt.filerev.templating.asset.path_package');
         $sslPackage->setScope('request')->replaceArgument(1, $rootDir)->replaceArgument(2, $summaryFile)->replaceArgument(3, $cacheDir)->replaceArgument(4, $debug);
     }
     $container->setDefinition($prefix . '.ssl', $sslPackage);
     $package = new DefinitionDecorator('templating.asset.request_aware_package');
     $package->setPublic(false)->setScope('request')->replaceArgument(1, $prefix . '.http')->replaceArgument(2, $prefix . '.ssl');
     return $package;
 }
開發者ID:necatikartal,項目名稱:generator-grunt-symfony,代碼行數:42,代碼來源:GruntExtension.php

示例4: 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

示例5: load

 /**
  * {@inheritdoc}
  */
 public function load(array $configs, ContainerBuilder $container)
 {
     $configuration = new Configuration();
     $config = $this->processConfiguration($configuration, $configs);
     $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
     $loader->load('services.yml');
     foreach ($config['connections'] as $name => $values) {
         $def = new Definition();
         $def->setClass($container->getParameter('agentsib_sphinx.connection.class'));
         $params = array('host' => $values['host'], 'port' => $values['port']);
         if ($values['socket']) {
             $params['socket'] = $values['socket'];
         }
         $def->setArguments(array($name, $values['driver'], $params));
         $def->addMethodCall('addLogger', array(new Reference('agentsib_sphinx.logger')));
         $container->setDefinition(sprintf('agentsib_sphinx.%s.connection', $name), $def);
         $helperDef = new DefinitionDecorator('agentsib_sphinx.factory.helper');
         $helperDef->setFactoryClass($container->getParameter('agentsib_sphinx.helper.class'));
         $helperDef->setFactoryMethod('create');
         $helperDef->addArgument(new Reference(sprintf('agentsib_sphinx.%s.connection', $name)));
         $helperDef->setPublic(true);
         $container->setDefinition(sprintf('agentsib_sphinx.%s.helper', $name), $helperDef);
         if ($name == $config['default_connection']) {
             $container->setAlias('agentsib_sphinx.connection', sprintf('agentsib_sphinx.%s.connection', $name));
             $container->setAlias('agentsib_sphinx.helper', sprintf('agentsib_sphinx.%s.helper', $name));
         }
     }
 }
開發者ID:agentsib,項目名稱:sphinx-bundle,代碼行數:31,代碼來源:AgentSIBSphinxExtension.php

示例6: 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

示例7: createStorage

 /**
  * {@inheritDoc}
  */
 protected function createStorage(ContainerBuilder $container, $modelClass, array $config)
 {
     $loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../../../Resources/config/storage'));
     $loader->load('propel1.xml');
     $storage = new DefinitionDecorator('payum.storage.propel1');
     $storage->setPublic(true);
     $storage->replaceArgument(0, $modelClass);
     return $storage;
 }
開發者ID:DocHoncho,項目名稱:PayumBundle,代碼行數:12,代碼來源:Propel1StorageFactory.php

示例8: createStorage

 /**
  * {@inheritDoc}
  */
 protected function createStorage(ContainerBuilder $container, $modelClass, array $config)
 {
     $loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../../../Resources/config/storage'));
     $loader->load('doctrine.' . $config['driver'] . '.xml');
     $storage = new DefinitionDecorator(sprintf('payum.storage.doctrine.%s', $config['driver']));
     $storage->setPublic(true);
     $storage->replaceArgument(1, $modelClass);
     return $storage;
 }
開發者ID:Raxer971,項目名稱:challenge,代碼行數:12,代碼來源:DoctrineStorageFactory.php

示例9: addApis

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

示例10: addApis

 /**
  * {@inheritDoc}
  */
 protected function addApis(Definition $paymentDefinition, ContainerBuilder $container, $contextName, array $config)
 {
     $apiDefinition = new DefinitionDecorator('payum.limonetik.api.prototype');
     $apiDefinition->replaceArgument(0, array('merchantId' => $config['merchant_id'], 'key' => $config['key'], 'sandbox' => $config['sandbox']));
     $apiDefinition->setPublic(true);
     $apiId = 'payum.context.' . $contextName . '.api';
     $container->setDefinition($apiId, $apiDefinition);
     $paymentDefinition->addMethodCall('addApi', array(new Reference($apiId)));
 }
開發者ID:winzou,項目名稱:payum-limonetik,代碼行數:12,代碼來源:LimonetikPaymentFactory.php

示例11: addApis

 /**
  * {@inheritDoc}
  */
 protected function addApis(Definition $paymentDefinition, ContainerBuilder $container, $contextName, array $config)
 {
     $apiDefinition = new DefinitionDecorator('payum.paypal.express_checkout_nvp.api.prototype');
     $apiDefinition->replaceArgument(0, array('username' => $config['username'], 'password' => $config['password'], 'signature' => $config['signature'], 'sandbox' => $config['sandbox']));
     $apiDefinition->setPublic(true);
     $apiId = 'payum.context.' . $contextName . '.api';
     $container->setDefinition($apiId, $apiDefinition);
     $paymentDefinition->addMethodCall('addApi', array(new Reference($apiId)));
 }
開發者ID:sanchojaf,項目名稱:oldmytriptocuba,代碼行數:12,代碼來源:PaypalExpressCheckoutNvpPaymentFactory.php

示例12: 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

示例13: convert

 /**
  * Converts class hierarchy metadata to definition instances.
  *
  * @param ClassHierarchyMetadata $metadata
  * @return array an array of Definition instances
  */
 public function convert(ClassHierarchyMetadata $metadata)
 {
     static $count = 0;
     $definitions = array();
     $previous = null;
     foreach ($metadata->classMetadata as $classMetadata) {
         if (null === $previous && null === $classMetadata->parent) {
             $definition = new Definition();
         } else {
             $definition = new DefinitionDecorator($classMetadata->parent ?: $previous->id);
         }
         $definition->setClass($classMetadata->name);
         if (null !== $classMetadata->scope) {
             $definition->setScope($classMetadata->scope);
         }
         if (null !== $classMetadata->public) {
             $definition->setPublic($classMetadata->public);
         }
         if (null !== $classMetadata->abstract) {
             $definition->setAbstract($classMetadata->abstract);
         }
         if (null !== $classMetadata->lazy) {
             $definition->setLazy($classMetadata->lazy);
         }
         if (null !== $classMetadata->arguments) {
             $definition->setArguments($classMetadata->arguments);
         }
         $definition->setMethodCalls($classMetadata->methodCalls);
         $definition->setTags($classMetadata->tags);
         $definition->setProperties($classMetadata->properties);
         if (null !== $classMetadata->decorates) {
             if (!method_exists($definition, 'setDecoratedService')) {
                 throw new InvalidAnnotationException(sprintf("decorations require symfony >=2.8 on class %s", $classMetadata->name));
             }
             $definition->setDecoratedService($classMetadata->decorates, $classMetadata->decoration_inner_name);
         }
         if (null !== $classMetadata->deprecated && method_exists($definition, 'setDeprecated')) {
             $definition->setDeprecated(true, $classMetadata->deprecated);
         }
         if (null === $classMetadata->id) {
             $classMetadata->id = '_jms_di_extra.unnamed.service_' . $count++;
         }
         if (0 !== count($classMetadata->initMethods)) {
             foreach ($classMetadata->initMethods as $initMethod) {
                 $definition->addMethodCall($initMethod);
             }
         } elseif (null !== $classMetadata->initMethod) {
             @trigger_error('ClassMetadata::$initMethod is deprecated since version 1.7 and will be removed in 2.0. Use ClassMetadata::$initMethods instead.', E_USER_DEPRECATED);
             $definition->addMethodCall($classMetadata->initMethod);
         }
         $definitions[$classMetadata->id] = $definition;
         $previous = $classMetadata;
     }
     return $definitions;
 }
開發者ID:alber999,項目名稱:JMSDiExtraBundle,代碼行數:61,代碼來源:MetadataConverter.php

示例14: createPackageDefinition

 /**
  * Returns a definition for an asset package.
  */
 private function createPackageDefinition($basePath, array $baseUrls, Reference $version)
 {
     if ($basePath && $baseUrls) {
         throw new \LogicException('An asset package cannot have base URLs and base paths.');
     }
     if (!$baseUrls) {
         $package = new DefinitionDecorator('assets.path_package');
         return $package->setPublic(false)->replaceArgument(0, $basePath)->replaceArgument(1, $version);
     }
     $package = new DefinitionDecorator('assets.url_package');
     return $package->setPublic(false)->replaceArgument(0, $baseUrls)->replaceArgument(1, $version);
 }
開發者ID:kuborgh-bzoerb,項目名稱:FilerevBundle,代碼行數:15,代碼來源:ZoerbFilerevExtension.php

示例15: addApis

 /**
  * {@inheritDoc}
  */
 protected function addApis(Definition $paymentDefinition, ContainerBuilder $container, $contextName, array $config)
 {
     $options = array('merchant_id' => $config['merchant_id'], 'merchant_password' => $config['merchant_password'], 'receiver_email' => $config['receiver_email'], 'sandbox' => $config['sandbox']);
     if (isset($config['sandbox_url'])) {
         $options['sandbox_url'] = $config['sandbox_url'];
     }
     $apiDefinition = new DefinitionDecorator('eki.payum.nganluong.api.prototype');
     $apiDefinition->replaceArgument(0, $options);
     $apiDefinition->setPublic(true);
     $apiId = 'payum.context.' . $contextName . '.api';
     $container->setDefinition($apiId, $apiDefinition);
     $paymentDefinition->addMethodCall('addApi', array(new Reference($apiId)));
 }
開發者ID:ekipower,項目名稱:payum-nganluong,代碼行數:16,代碼來源:BasePaymentFactory.php


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