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


PHP Injector::defineParam方法代码示例

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


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

function createControl(PageInfo $pageInfo, Injector $injector)
{
    list($controlClassname, $params) = CategoryInfo::getDIInfo($pageInfo);
    foreach ($params as $name => $value) {
        $injector->defineParam($name, $value);
    }
    $control = $injector->make($controlClassname);
    $params = $control->getFullParams();
    foreach ($params as $name => $value) {
        $injector->defineParam($name, $value);
    }
    return $control;
}
开发者ID:finelinePG,项目名称:imagick,代码行数:13,代码来源:appFunctions.php

示例3: getCustomImageResponse

 /**
  * @param \Auryn\Injector $injector
  * @param $customImageFunction
  * @param \ImagickDemo\Example $exampleController
  * @param \ImagickDemo\Control $control
  * @return mixed
  * @throws \Exception
  */
 function getCustomImageResponse(CategoryNav $categoryNav, \Auryn\Injector $injector, $customImageFunction, \ImagickDemo\Example $exampleController, \ImagickDemo\Control $control)
 {
     $injector->defineParam('imageFunction', $customImageFunction);
     $params = $control->getFullParams($exampleController->getCustomImageParams());
     $defaultCustomParams = array('customImage' => true);
     $params = array_merge($defaultCustomParams, $params);
     return $this->getImageResponseInternal($categoryNav, $injector, $params);
 }
开发者ID:sdmmember,项目名称:Imagick-demos,代码行数:16,代码来源:Image.php

示例4: execute

 /**
  *
  */
 public function execute()
 {
     //Figure out what Command was requested.
     try {
         $parsedCommand = $this->console->parseCommandLine();
     } catch (ConfiguratorException $ce) {
         echo "Problem running configuration: " . $ce->getMessage();
         exit(-1);
     } catch (\Exception $e) {
         //@TODO change to just catch parseException when that's implemented
         $output = new BufferedOutput();
         $this->console->renderException($e, $output);
         echo $output->fetch();
         exit(-1);
     }
     //Run the command requested, or the help callable if no command was input
     try {
         $output = $parsedCommand->getOutput();
         $formatter = $output->getFormatter();
         $formatter->setStyle('question', new OutputFormatterStyle('blue'));
         $formatter->setStyle('info', new OutputFormatterStyle('blue'));
         $questionHelper = new QuestionHelper();
         $questionHelper->setHelperSet($this->console->getHelperSet());
         // We currently have no config, so fine to create this directly.
         $injector = new Injector();
         $injector->alias('Configurator\\Writer', 'Configurator\\Writer\\FileWriter');
         $injector->defineParam('originalArgs', $this->originalArgs);
         foreach ($parsedCommand->getParams() as $key => $value) {
             $injector->defineParam($key, $value);
         }
         $injector->execute($parsedCommand->getCallable());
     } catch (ConfiguratorException $ce) {
         echo "Error running task: \n";
         echo $ce->getMessage();
         exit(-1);
     } catch (\Exception $e) {
         echo "Unexpected exception of type " . get_class($e) . " running configurator`: " . $e->getMessage() . PHP_EOL;
         echo $e->getTraceAsString();
         exit(-2);
     }
 }
开发者ID:danack,项目名称:configurator,代码行数:44,代码来源:CliRunner.php

示例5: testTypelessDefineForAliasedDependency

 public function testTypelessDefineForAliasedDependency()
 {
     $injector = new Injector();
     $injector->defineParam('val', 42);
     $injector->alias('Auryn\\Test\\TestNoExplicitDefine', 'Auryn\\Test\\ProviderTestCtorParamWithNoTypehintOrDefault');
     $obj = $injector->make('Auryn\\Test\\ProviderTestCtorParamWithNoTypehintOrDefaultDependent');
 }
开发者ID:barthelemy-ehui,项目名称:auryn,代码行数:7,代码来源:InjectorTest.php

示例6: addInjectionParams

function addInjectionParams(Injector $injector, Tier $tier)
{
    $injectionParams = $tier->getInjectionParams();
    if (!$injectionParams) {
        return;
    }
    foreach ($injectionParams->getAliases() as $original => $alias) {
        $injector->alias($original, $alias);
    }
    foreach ($injectionParams->getShares() as $share) {
        $injector->share($share);
    }
    foreach ($injectionParams->getParams() as $paramName => $value) {
        $injector->defineParam($paramName, $value);
    }
    foreach ($injectionParams->getDelegates() as $className => $callable) {
        $injector->delegate($className, $callable);
    }
}
开发者ID:PeeHaa,项目名称:Jig,代码行数:19,代码来源:bootstrap.php


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