當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。