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


PHP Container\ContainerInterface类代码示例

本文整理汇总了PHP中Interop\Container\ContainerInterface的典型用法代码示例。如果您正苦于以下问题:PHP ContainerInterface类的具体用法?PHP ContainerInterface怎么用?PHP ContainerInterface使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: __invoke

 /**
  * Create and return a NoRecordExists validator.
  *
  * @param ContainerInterface $container
  * @param string $requestedName
  * @param null|array $options
  * @return NoRecordExists
  */
 public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
 {
     if (isset($options['adapter'])) {
         return new NoRecordExists(ArrayUtils::merge($options, ['adapter' => $container->get($options['adapter'])]));
     }
     return new NoRecordExists($options);
 }
开发者ID:zfcampus,项目名称:zf-content-validation,代码行数:15,代码来源:NoRecordExistsFactory.php

示例2: __invoke

 public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
 {
     $config = $container->get('config');
     $collectorConfig = ['service_name' => isset($config['hermes']['service_name']) ? $config['hermes']['service_name'] : '', 'api_key' => isset($config['kharon']['api_key']) ? $config['kharon']['api_key'] : null, 'kharon_dir' => isset($config['kharon']['agent_dir']) ? $config['kharon']['agent_dir'] : 'data/kharon'];
     $collectorConfig['kharon_dir'] .= '/hermes';
     return new Collector($collectorConfig);
 }
开发者ID:mt-olympus,项目名称:kharon-hermes,代码行数:7,代码来源:CollectorFactory.php

示例3: __invoke

 /**
  * @param ContainerInterface $container
  *
  * @return PhpRenderer
  */
 public function __invoke(ContainerInterface $container)
 {
     $helper = $container->get(HelperPluginManager::class);
     $renderer = new PhpRenderer();
     $renderer->setHelperPluginManager($helper);
     return $renderer;
 }
开发者ID:oqq,项目名称:ci-zend-form-twig-extension,代码行数:12,代码来源:ZendFormPhpRendererFactory.php

示例4: __invoke

 public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
 {
     $config = $container->has('config') ? $container->get('config') : [];
     $debug = array_key_exists('debug', $config) ? (bool) $config['debug'] : false;
     $options = $config['session']['psr7'];
     return new SessionMiddleware(new Sha256(), $options['signature_key'], $options['verification_key'], SetCookie::create($options['cookie_name'])->withSecure($options['cookie_secure'])->withHttpOnly(true), new Parser(), $options['expiration_time']);
 }
开发者ID:jkhaled,项目名称:xtreamwayz.com,代码行数:7,代码来源:SessionMiddlewareFactory.php

示例5: __invoke

 public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
 {
     $client = $container->get('NewRelic\\Client');
     $options = $container->get('NewRelic\\ModuleOptions');
     $logger = $container->get('NewRelic\\Logger');
     return new ErrorListener($client, $options, $logger);
 }
开发者ID:neeckeloo,项目名称:newrelic,代码行数:7,代码来源:ErrorListenerFactory.php

示例6: __construct

 public function __construct(FrameBuffer $frameBuffer, ContainerInterface $container)
 {
     $this->frameBuffer = $frameBuffer;
     $this->container = $container;
     $this->bitmapLoader = $container->get(BitmapLoader::class);
     $this->sprites = [];
 }
开发者ID:hackheim,项目名称:pixelpong,代码行数:7,代码来源:BaseGameLoop.php

示例7: __invoke

 /**
  * Create an object
  *
  * @param  ContainerInterface $container
  * @param  string $requestedName
  * @param  null|array $options
  * @return object|\Swift_Mailer
  * @throws ServiceNotFoundException if unable to resolve the service.
  * @throws ServiceNotCreatedException if an exception is raised when
  *     creating a service.
  * @throws ContainerException if any other error occurs
  */
 public function __invoke(ContainerInterface $container, $requestedName, array $options = null) : \Swift_Mailer
 {
     $mailConfig = $container->get('config')['mail'];
     $smtp = $mailConfig['smtp'];
     $transport = \Swift_SmtpTransport::newInstance($smtp['server'], $smtp['port'], $smtp['ssl'])->setUsername($smtp['username'])->setPassword($smtp['password']);
     return new \Swift_Mailer($transport);
 }
开发者ID:acelaya,项目名称:alejandrocelaya.com,代码行数:19,代码来源:SwiftMailerFactory.php

示例8: __invoke

 /**
  * @param  ContainerInterface $container
  * @param  string $name
  * @param  null|array $options
  * @return DefaultRenderingStrategy
  */
 public function __invoke(ContainerInterface $container, $name, array $options = null)
 {
     $strategy = new DefaultRenderingStrategy($container->get(View::class));
     $config = $this->getConfig($container);
     $this->injectLayoutTemplate($strategy, $config);
     return $strategy;
 }
开发者ID:kuisatz,项目名称:ustalarMerkezi,代码行数:13,代码来源:HttpDefaultRenderingStrategyFactory.php

示例9: __invoke

 public function __invoke(ContainerInterface $container)
 {
     if (!$container->has(Configuration::class) || !$container->has(EventManager::class) || !$container->has(Connection::class)) {
         throw new ContainerNotRegisteredException('Doctrine\\Common\\EventManager::class,
         Doctrine\\ORM\\Configuration::class and Doctrine\\DBAL\\Connection::class
         must be registered in the container');
     }
     $config = $container->has('config') ? $container->get('config') : [];
     $underscoreNamingStrategy = isset($config['doctrine']['orm']['underscore_naming_strategy']) ? $config['doctrine']['orm']['underscore_naming_strategy'] : false;
     /** @var Configuration $configuration */
     $configuration = $container->get(Configuration::class);
     $configuration->setProxyDir(isset($config['doctrine']['orm']['proxy_dir']) ? $config['doctrine']['orm']['proxy_dir'] : 'data/cache/EntityProxy');
     $configuration->setProxyNamespace(isset($config['doctrine']['orm']['proxy_namespace']) ? $config['doctrine']['orm']['proxy_namespace'] : 'EntityProxy');
     $configuration->setAutoGenerateProxyClasses(isset($config['doctrine']['orm']['auto_generate_proxy_classes']) ? $config['doctrine']['orm']['auto_generate_proxy_classes'] : false);
     // ORM mapping by Annotation
     AnnotationRegistry::registerFile('vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/Driver/DoctrineAnnotations.php');
     $driver = new AnnotationDriver(new AnnotationReader(), ['data/cache/doctrine']);
     $configuration->setMetadataDriverImpl($driver);
     // Cache
     $cache = $container->get(Cache::class);
     $configuration->setQueryCacheImpl($cache);
     $configuration->setResultCacheImpl($cache);
     $configuration->setMetadataCacheImpl($cache);
     return EntityManager::create($container->get(Connection::class), $configuration, $container->get(EventManager::class));
 }
开发者ID:mobicms,项目名称:expressive-doctrine,代码行数:25,代码来源:OrmFactory.php

示例10: __invoke

 /**
  * Create service
  *
  * @param ContainerInterface $container
  * @return mixed
  */
 public function __invoke(ContainerInterface $container)
 {
     $config = $container->get('config');
     $cacheEnabled = isset($config['view']['cache']) ? (bool) $config['view']['cache'] : false;
     $layout = isset($config['view']['layout']) && is_string($config['view']['layout']) ? $config['view']['layout'] : 'CargoUI/view/layout/layout.phtml';
     return new Main($layout, $cacheEnabled, $container->get(RiotCompiler::class));
 }
开发者ID:josecelano,项目名称:php-ddd-cargo-sample,代码行数:13,代码来源:MainFactory.php

示例11: __invoke

 /**
  * @param ContainerInterface $container
  * @return ModuleVersioningModelFactory
  * @throws ServiceNotCreatedException
  */
 public function __invoke(ContainerInterface $container)
 {
     if (!$container->has(ConfigResourceFactory::class) || !$container->has(ModulePathSpec::class)) {
         throw new ServiceNotCreatedException(sprintf('%s is missing one or more dependencies from ZF\\Configuration', ModuleVersioningModelFactory::class));
     }
     return new ModuleVersioningModelFactory($container->get(ConfigResourceFactory::class), $container->get(ModulePathSpec::class));
 }
开发者ID:zfcampus,项目名称:zf-apigility-admin,代码行数:12,代码来源:ModuleVersioningModelFactoryFactory.php

示例12: __construct

 /**
  * Constructor
  *
  * @param string $action Type of action to validate
  * @param ServerRequestInterface $request Request Http
  * @param ContainerInterface $container Dependency Injection
  */
 public function __construct($action, ServerRequestInterface $request, ContainerInterface $container)
 {
     $this->action = $action;
     $this->idUser = $request->getAttribute('id');
     $this->data = $request->getParsedBody();
     $this->entityManager = $container->get('EntityManager');
 }
开发者ID:danielspk,项目名称:tornadohttpskeletonapplication,代码行数:14,代码来源:UserValidator.php

示例13: __invoke

 public function __invoke(ContainerInterface $ci)
 {
     $settings = $ci->get('settings');
     $view = new Twig($settings['twig']['view_path'], $settings['twig']['settings']);
     $view->addExtension(new TwigExtension($ci['router'], $ci['request']->getUri()));
     return $view;
 }
开发者ID:renatoaraujo,项目名称:slim-skeleton,代码行数:7,代码来源:TwigViewService.php

示例14: __invoke

 public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
 {
     $entityManager = $container->get('doctrine.entitymanager.orm_default');
     $config = $container->get('Config')['svycka_social_user'];
     $options = ['social_user_entity' => $config['social_user_entity']];
     return new Doctrine($entityManager, $options);
 }
开发者ID:svycka,项目名称:social-user,代码行数:7,代码来源:DoctrineStorageFactory.php

示例15: __invoke

 /**
  * @inheritDoc
  */
 public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
 {
     $config = $container->get('config');
     $config = isset($config['asset_manager']) ? $config['asset_manager'] : array();
     $resolver = new AggregateResolver();
     if (empty($config['resolvers'])) {
         return $resolver;
     }
     foreach ($config['resolvers'] as $resolverService => $priority) {
         $resolverService = $container->get($resolverService);
         if (!$resolverService instanceof ResolverInterface) {
             throw new Exception\RuntimeException('Service does not implement the required interface ResolverInterface.');
         }
         if ($resolverService instanceof AggregateResolverAwareInterface) {
             $resolverService->setAggregateResolver($resolver);
         }
         if ($resolverService instanceof MimeResolverAwareInterface) {
             $resolverService->setMimeResolver($container->get(MimeResolver::class));
         }
         if ($resolverService instanceof AssetFilterManagerAwareInterface) {
             $resolverService->setAssetFilterManager($container->get(AssetFilterManager::class));
         }
         $resolver->attach($resolverService, $priority);
     }
     return $resolver;
 }
开发者ID:rwoverdijk,项目名称:assetmanager,代码行数:29,代码来源:AggregateResolverServiceFactory.php


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