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


PHP HelperPluginManager::has方法代碼示例

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


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

示例1: perform_do

 public function perform_do($args)
 {
     $name = array_shift($args);
     if (is_string($name) == false) {
         return null;
     }
     if ($this->helpers->has($name) == false) {
         return null;
     }
     call_user_func_array($this->helpers->get($name), $args);
 }
開發者ID:ngyuki,項目名稱:zf2-smarty,代碼行數:11,代碼來源:CompilerPlugin.php

示例2: setHelperPluginManager

 /**
  * Set helper plugin manager instance.
  *
  * Also ensures that the 'Hal' helper is present.
  *
  * @param  HelperPluginManager $helpers
  */
 public function setHelperPluginManager(HelperPluginManager $helpers)
 {
     if (!$helpers->has('Hal')) {
         $this->injectHalHelper($helpers);
     }
     $this->helpers = $helpers;
 }
開發者ID:zpetr,項目名稱:apigility-xmlnegotiation,代碼行數:14,代碼來源:XmlRenderer.php

示例3: buildGraph

 /**
  * @param $className
  *
  * @return object
  * @throws \Exception
  */
 private function buildGraph($className)
 {
     if ($this->enableObjectGraphDebug) {
         echo 'Building an object from the class: ' . $className . "<br />";
     }
     try {
         $reflection = new \ReflectionClass($className);
     } catch (\Exception $e) {
         if ($this->enableObjectGraphDebug) {
             echo 'Could not build a reflection class for ' . $className . "<br />";
         }
         return false;
     }
     if (!$reflection->getConstructor()) {
         if ($this->enableObjectGraphDebug) {
             echo 'We have build an object for class ' . $className . "<br />";
         }
         return new $className();
     }
     $constructorParameters = $reflection->getConstructor()->getParameters();
     $dependencies = [];
     foreach ($constructorParameters as $param) {
         try {
             $paramClassName = $param->getClass();
         } catch (\Exception $e) {
             throw new \Exception('Could not create dependency class "' . $param->getName() . '" for the currently building class: ' . $className);
         }
         if (!$paramClassName) {
             switch (true) {
                 case $this->controllerPluginManager->has($param->name, false):
                     if ($this->enableObjectGraphDebug) {
                         echo 'The parameter "' . $param->name . '" exists in Controller Manager' . "<br />";
                     }
                     $dependencies[] = $this->controllerPluginManager->get($param->name);
                     break;
                 case $this->serviceManager->has($param->name, false):
                     if ($this->enableObjectGraphDebug) {
                         echo 'The parameter "' . $param->name . '" exists in Service Manager' . "<br />";
                     }
                     $dependencies[] = $this->serviceManager->get($param->name);
                     break;
                 default:
                     if ($param->isOptional()) {
                         $dependencies[] = $param->getDefaultValue();
                     } else {
                         if ($this->enableObjectGraphDebug) {
                             echo 'The parameter "' . $param->name . '" does not exist in (any) Service Manager' . "<br />";
                         }
                         echo 'The parameter "' . $param->name . '" does not exist in the Service Manager' . "<br />";
                         die;
                     }
                     break;
             }
         } else {
             if ($this->enableObjectGraphDebug) {
                 echo 'Does the SM have an object for ' . $param->getClass()->name . "<br />";
             }
             switch (true) {
                 case $this->controllerPluginManager->has($param->getClass()->name, false, false):
                     if ($this->enableObjectGraphDebug) {
                         echo 'It does in the Controller Plugin Manager' . "<br />";
                     }
                     $dependencies[] = $this->controllerPluginManager->get($param->getClass()->name);
                     break;
                 case $this->viewHelperManager->has($param->getClass()->name, false, false):
                     if ($this->enableObjectGraphDebug) {
                         echo 'It does in the View Helper Manager' . "<br />";
                     }
                     $dependencies[] = $this->viewHelperManager->get($param->getClass()->name);
                     break;
                 case $this->formElementManager->has($param->getClass()->name, false, false):
                     if ($this->enableObjectGraphDebug) {
                         echo 'It does in the Form Element Manager' . "<br />";
                     }
                     $dependencies[] = $this->formElementManager->get($param->getClass()->name);
                     break;
                 case $this->serviceManager->has($param->getClass()->name, false, false):
                     if ($this->enableObjectGraphDebug) {
                         echo 'It does in the Service Manager' . "<br />";
                     }
                     $name = $param->getClass()->name;
                     if ($this->serviceManager->hasAlias($name)) {
                         $config = $this->serviceManager->get('config')['service_manager'];
                         $name = $config['aliases'][$name];
                     }
                     $dependencies[] = $this->serviceManager->get($name);
                     break;
                 default:
                     if ($this->enableObjectGraphDebug) {
                         echo 'No it It does not have an object' . "<br />";
                     }
                     if ($param->getClass()->isInterface()) {
                         continue;
                     }
//.........這裏部分代碼省略.........
開發者ID:middleout,項目名稱:mdo-bundle-zf2-auto-dep-inject,代碼行數:101,代碼來源:AbstractGenericFactory.php

示例4: testInjectsCustomHelpersIntoHelperManagerFromContainer

 /**
  * @depends testWillUseHelperManagerFromContainer
  */
 public function testInjectsCustomHelpersIntoHelperManagerFromContainer(HelperPluginManager $helpers)
 {
     $this->assertTrue($helpers->has('url'));
     $this->assertTrue($helpers->has('serverurl'));
     $this->assertInstanceOf(ZendView\UrlHelper::class, $helpers->get('url'));
     $this->assertInstanceOf(ZendView\ServerUrlHelper::class, $helpers->get('serverurl'));
 }
開發者ID:kynx,項目名稱:zend-expressive,代碼行數:10,代碼來源:ZendViewFactoryTest.php


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