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


PHP Injector::share方法代码示例

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


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

示例1: addToInjector

 public function addToInjector(Injector $injector)
 {
     foreach ($this->shares as $share) {
         $injector->share($share);
     }
     foreach ($this->aliases as $original => $alias) {
         $injector->alias($original, $alias);
     }
     foreach ($this->definitions as $name => $args) {
         $injector->define($name, $args);
     }
     foreach ($this->params as $param => $value) {
         $injector->defineParam($param, $value);
     }
     foreach ($this->delegates as $param => $callable) {
         $injector->delegate($param, $callable);
     }
     foreach ($this->prepares as $class => $callable) {
         $injector->prepare($class, $callable);
     }
 }
开发者ID:zvax,项目名称:stepping,代码行数:21,代码来源:InjectionParams.php

示例2: registerExceptionHandlerServices

 private function registerExceptionHandlerServices(Injector $injector)
 {
     $injector->share(Run::class);
     $injector->prepare(Run::class, function (Run $run) {
         $run->pushHandler(new PrettyPageHandler());
     });
     $injector->share(ExceptionHandlingPlugin::class);
 }
开发者ID:cspray,项目名称:labrador-http,代码行数:8,代码来源:Services.php

示例3: apply

 /**
  * @inheritDoc
  */
 public function apply(Injector $injector)
 {
     $injector->alias('Psr\\Http\\Message\\ResponseInterface', 'Zend\\Diactoros\\Response');
     $injector->share('Psr\\Http\\Message\\ResponseInterface');
     $injector->delegate('Psr\\Http\\Message\\ServerRequestInterface', 'Zend\\Diactoros\\ServerRequestFactory::fromGlobals');
     $injector->share('Psr\\Http\\Message\\ServerRequestInterface');
     $injector->alias('Psr\\Http\\Message\\RequestInterface', 'Psr\\Http\\Message\\ServerRequestInterface');
 }
开发者ID:mHz28,项目名称:rest-scheduler-api,代码行数:11,代码来源:DiactorosConfiguration.php

示例4: setTemplatePath

 /**
  * Sets the templates path.
  *
  * @param  string            $path
  * @param  \Twig_Environment $twig
  * @param  array             $extensions
  * @return self
  */
 public function setTemplatePath($path, \Twig_Environment $twig = null, $extensions = [])
 {
     $this->paths['templates'] = $path;
     if (is_null($twig)) {
         $loader = new \Twig_Loader_Filesystem($path);
         $twig = new \Twig_Environment($loader);
     }
     $twig->setExtensions($extensions);
     $this->injector->share($twig);
     return $this;
 }
开发者ID:rougin,项目名称:blueprint,代码行数:19,代码来源:Blueprint.php

示例5: performInjections

 /**
  * @param array $injections Single dimensional array of shareable values from the Silex\Application (pimple) object
  *
  * @return void
  */
 public function performInjections(array $injections)
 {
     foreach ($injections as $shareable) {
         $this->injector->share($this->application[$shareable]);
     }
     /**
      * This can only be done here because security / user is only read to be read after boot
      */
     if (isset($this->application['twig']) && isset($this->application['security.authorization_checker'])) {
         $this->application['twig']->addExtension(new SecurityExtension($this->application['security.authorization_checker']));
     }
 }
开发者ID:j7mbo,项目名称:aurex,代码行数:17,代码来源:DelayedInjectionHandler.php

示例6: createInjector

function createInjector()
{
    $jigTemplatePath = new \Jig\JigTemplatePath(__DIR__ . "/fixtures/templates/");
    $jigCompilePath = new \Jig\JigCompilePath(__DIR__ . "/var/generatedTemplates/");
    // Create a JigConfig object
    $jigConfig = new JigConfig($jigTemplatePath, $jigCompilePath, Jig::COMPILE_CHECK_MTIME);
    $injector = new Injector();
    $injector->alias('Jig\\Escaper', 'Jig\\Bridge\\ZendEscaperBridge');
    $injector->delegate('FastRoute\\Dispatcher', 'TierTest\\JigBridge\\createDispatcher');
    $injector->share('FastRoute\\Dispatcher');
    $injector->share($jigConfig);
    return $injector;
}
开发者ID:danack,项目名称:tier,代码行数:13,代码来源:phpunit_bootstrap.php

示例7: setUp

 public function setUp()
 {
     parent::setUp();
     $this->compileDirectory = new JigCompilePath(dirname(__DIR__) . "/./../tmp/generatedTemplates/");
     $this->templateDirectory = new JigTemplatePath(dirname(__DIR__) . "/./templates/");
     $jigConfig = new JigConfig($this->templateDirectory, $this->compileDirectory, Jig::COMPILE_ALWAYS, "php.tpl");
     $injector = new \Auryn\Injector();
     $this->injector = $injector;
     $escaper = new ZendEscaperBridge(new ZendEscaper());
     $this->injector->alias('Jig\\Escaper', get_class($escaper));
     $this->injector->share($escaper);
     $this->jigDispatcher = new JigDispatcher($jigConfig, $injector);
 }
开发者ID:danack,项目名称:jig,代码行数:13,代码来源:JigConverterTest.php

示例8: setUp

 protected function setUp()
 {
     define('MODEL_DIR', '\\Test\\Model');
     //define('DEBUG_MODE', true);
     $this->injector = new Injector();
     $this->injector->share(Database::class);
     $this->database = $this->injector->make('Minute\\Database\\Database', [true]);
     try {
         $this->pdo = $this->database->getPdo();
     } catch (\PDOException $e) {
         $this->markTestSkipped('Database connection error: ' . $e->getMessage());
     }
     parent::setUp();
 }
开发者ID:minutephp,项目名称:framework,代码行数:14,代码来源:PHPUnit_Db_Test_Base.php

示例9: __invoke

 public function __invoke(Injector $injector)
 {
     $injector->share($injector);
     foreach ($this->classes as $class) {
         $injector->execute($class);
     }
 }
开发者ID:elazar,项目名称:auryn-configuration,代码行数:7,代码来源:ConfigurationSet.php

示例10: setMedoo

 function setMedoo()
 {
     $injector = new Injector();
     $injector->share('medoo');
     $injector->define('medoo', [':options' => $this->databaseconfig]);
     $this->medoodb = $injector->make('medoo');
 }
开发者ID:WeihuaGu,项目名称:incolor,代码行数:7,代码来源:Model.php

示例11: run

 /**
  * Run the application
  *
  * @param string $runner
  *
  * @return \Psr\Http\Message\ResponseInterface
  */
 public function run($runner = 'Relay\\Relay')
 {
     foreach ($this->configuration as $entry) {
         $this->injector->make($entry)->apply($this->injector);
     }
     return $this->injector->share($this->middleware)->prepare('Spark\\Directory', $this->routing)->execute($runner);
 }
开发者ID:curtis1000,项目名称:spark,代码行数:14,代码来源:Application.php

示例12: apply

 /**
  * Applies a configuration set to a dependency injector.
  *
  * @param Injector $injector
  */
 public function apply(Injector $injector)
 {
     $paths = ["src/Users/Entity/", "src/Shifts/Entity/"];
     $isDevMode = true;
     // the connection configuration
     $dbParams = array('host' => $_ENV['DB_HOST'], 'driver' => $_ENV['DB_DRIVER'], 'user' => $_ENV['DB_USER'], 'password' => $_ENV['DB_PASSWORD'], 'dbname' => $_ENV['DB_DATABASE_NAME']);
     $config = Setup::createAnnotationMetadataConfiguration($paths, $isDevMode, null, null, false);
     $injector->share(EntityManager::create($dbParams, $config));
 }
开发者ID:sctape,项目名称:rest-scheduler-api,代码行数:14,代码来源:DoctrineConfiguration.php

示例13: apply

 /**
  * Applies a configuration set to a dependency injector.
  *
  * @param Injector $injector
  */
 public function apply(Injector $injector)
 {
     // Create a new Manager instance.
     $manager = new Manager(new ArrayDriver());
     // Managers can do everything
     $manager->role('manager')->allow('all');
     //        $manager->role('employee')->allow('guest', 'read');
     $injector->share($manager);
 }
开发者ID:sctape,项目名称:rest-scheduler-api,代码行数:14,代码来源:AclConfiguration.php

示例14: apply

 public function apply(Injector $injector)
 {
     //START: auth
     $injector->alias(AdapterInterface::class, \trejeraos\SimpleServerMonitor\Auth\FooAdapter::class);
     $injector->alias(AuthHandler::class, FooAuthHandler::class);
     $injector->share(FooAuthHandler::class);
     // get auth token
     $injector->alias(TokenExtractorInterface::class, QueryExtractor::class);
     $injector->define(QueryExtractor::class, [':parameter' => 'tok']);
     // get auth credentials
     $injector->alias(CredentialsExtractorInterface::class, BodyExtractor::class);
     $injector->define(BodyExtractor::class, [':identifier' => 'user', ':password' => 'password']);
     // share valid auth token class
     $injector->share(\trejeraos\SimpleServerMonitor\Auth\ValidTokens::class);
     //END: auth
     // share global config class
     $injector->share(\trejeraos\SimpleServerMonitor\Data\Configuration::class);
 }
开发者ID:triple-j,项目名称:simple-server-monitor,代码行数:18,代码来源:FooConfiguration.php

示例15: getServiceLocator

 public function getServiceLocator()
 {
     if (!$this->service_locator) {
         $di_container = new DiContainer(new StandardReflector());
         $di_container->share($di_container);
         $service_provisioner = $di_container->make(ServiceProvisioner::CLASS);
         $this->service_locator = $service_provisioner->provision();
     }
     return $this->service_locator;
 }
开发者ID:honeybee,项目名称:honeybee-agavi-cmf-vendor,代码行数:10,代码来源:Context.php


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