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


PHP Zend_Reflection_Class::getMethod方法代码示例

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


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

示例1: testDocblockTags

 public function testDocblockTags()
 {
     $classReflection = new Zend_Reflection_Class('Zend_Reflection_TestSampleClass5');
     $this->assertEquals($classReflection->getMethod('doSomething')->getDocblock()->hasTag('return'), true);
     $returnTag = $classReflection->getMethod('doSomething')->getDocblock()->getTag('return');
     $this->assertEquals(get_class($returnTag), 'Zend_Reflection_Docblock_Tag_Return');
     $this->assertEquals($returnTag->getType(), 'mixed');
 }
开发者ID:jorgenils,项目名称:zend-framework,代码行数:8,代码来源:DocblockTest.php

示例2: testToString

 public function testToString()
 {
     $classReflection = new Zend_Reflection_Class('Zend_Reflection_TestSampleClass6');
     $tag = $classReflection->getMethod('doSomething')->getDocblock()->getTag('descriptionTag');
     $expectedString = "Docblock Tag [ * @descriptionTag ]" . PHP_EOL;
     $this->assertEquals($expectedString, (string) $tag);
 }
开发者ID:travisj,项目名称:zf,代码行数:7,代码来源:TagTest.php

示例3: routeShutdown

 public function routeShutdown(Zend_Controller_Request_Abstract $request)
 {
     if (!in_array(Zend_Controller_Front::getInstance()->getRouter()->getCurrentRouteName(), array('admin', 'admin_language'))) {
         return;
     }
     $resource = new User_Model_Acl_Resource();
     $resource->getAdminPrivileges();
     if ($resource->admin_privileges) {
         //$actionStack = Zend_Controller_Action_HelperBroker::getStaticHelper('ActionStack');
         $actionStack = new Zend_Controller_Plugin_ActionStack();
         foreach ($resource->admin_privileges as $module => $actions) {
             $class = ucfirst($module) . '_AdminController';
             if (!class_exists($class)) {
                 Zend_Loader::loadFile(APPLICATION_PATH . '/modules/' . $module . '/controllers/AdminController.php');
             }
             $reflection = new Zend_Reflection_Class($class);
             $method = null;
             try {
                 if ($method = $reflection->getMethod('menuAction')) {
                     $actionStack->pushStack(new Zend_Controller_Request_Simple('menu', 'admin', $module, array('admin_actions' => array_flip($actions))));
                 }
             } catch (Exception $e) {
             }
         }
     }
 }
开发者ID:ankuradhey,项目名称:laundry,代码行数:26,代码来源:AdminMenu.php

示例4: testNamespaceInParam

 /**
  * @group ZF-8307
  */
 public function testNamespaceInParam()
 {
     $classReflection = new Zend_Reflection_Class('Zend_Reflection_Docblock_Param_WithNamespace');
     $paramTag = $classReflection->getMethod('doSomething')->getDocblock()->getTag('param');
     $this->assertEquals('Zend\\Foo\\Bar', $paramTag->getType());
     $this->assertEquals('$var', $paramTag->getVariableName());
     $this->assertEquals('desc', $paramTag->getDescription());
 }
开发者ID:jsnshrmn,项目名称:Suma,代码行数:11,代码来源:ParamTest.php

示例5: _authenticateRequired

 /**
  * Prüft ob der Service einen Account benötigt
  * @param string $classname
  * @param string $methodname
  * @return boolean
  */
 private function _authenticateRequired($classname, $methodname)
 {
     try {
         $reflectionClass = new Zend_Reflection_Class($classname);
         return $reflectionClass->getMethod($methodname)->getDocblock()->hasTag('dragonx_account_authenticate');
     } catch (Exception $exception) {
     }
     return false;
 }
开发者ID:dragonprojects,项目名称:dragonjsonserver,代码行数:15,代码来源:Account.php

示例6: testMethodReturns

 public function testMethodReturns()
 {
     $reflectionClass = new Zend_Reflection_Class('Zend_Reflection_TestSampleClass2');
     $methodByName = $reflectionClass->getMethod('getProp1');
     $this->assertEquals('Zend_Reflection_Method', get_class($methodByName));
     $methodsAll = $reflectionClass->getMethods();
     $this->assertEquals(3, count($methodsAll));
     $firstMethod = array_shift($methodsAll);
     $this->assertEquals('getProp1', $firstMethod->getName());
 }
开发者ID:sasezaki,项目名称:mirror-zf1-tests,代码行数:10,代码来源:ClassTest.php

示例7: preDispatch

 /**
  * Prüft bei jedem Request ist die Authentifizierung
  * @param Dragon_Json_Server_Request_Http $request
  */
 public function preDispatch(Dragon_Json_Server_Request_Http $request)
 {
     try {
         list($classname, $methodname) = $request->parseMethod();
         $reflectionClass = new Zend_Reflection_Class($classname);
         $tagResource = $reflectionClass->getMethod($methodname)->getDocblock()->getTag('dragonx_acl_resource');
         if (!$tagResource) {
             return;
         }
         $resource = $tagResource->getDescription();
     } catch (Exception $exception) {
         return;
     }
     $resources = array();
     if (Zend_Registry::isRegistered('recordAccount')) {
         $logicAcl = new DragonX_Acl_Logic_Acl();
         $resources = $logicAcl->getResources(Zend_Registry::get('recordAccount'));
     }
     if (!in_array($resource, $resources)) {
         throw new Dragon_Application_Exception_System('missing resource', array('resource' => $resource));
     }
 }
开发者ID:dragonprojects,项目名称:dragonjsonserver,代码行数:26,代码来源:Acl.php

示例8: getFirstReflectionParameter

 /**
  * @param  string $method
  * @return Zend_Reflection_Parameter
  */
 private function getFirstReflectionParameter($method)
 {
     $reflClass = new Zend_Reflection_Class('Zend_CodeGenerator_Php_ParameterExample');
     $method = $reflClass->getMethod($method);
     $params = $method->getParameters();
     return array_shift($params);
 }
开发者ID:omusico,项目名称:logica,代码行数:11,代码来源:ParameterTest.php

示例9: testReturnClassWithNamespace

 /**
  * @group ZF-8307
  */
 public function testReturnClassWithNamespace()
 {
     $classReflection = new Zend_Reflection_Class('Zend_Reflection_Docblock_Param_WithNamespace');
     $paramTag = $classReflection->getMethod('doSomething')->getDocblock()->getTag('return');
     $this->assertEquals('Zend\\Reflection\\Docblock', $paramTag->getType());
 }
开发者ID:travisj,项目名称:zf,代码行数:9,代码来源:ReturnTest.php

示例10: getMethod

 /**
  *
  * @return ThemeHouse_Reflection_Method
  */
 public function getMethod($name, $reflectionClass = 'ThemeHouse_Reflection_Method')
 {
     return parent::getMethod($name, $reflectionClass);
 }
开发者ID:ThemeHouse-XF,项目名称:Reflection,代码行数:8,代码来源:Class.php

示例11: testType

 public function testType()
 {
     $classReflection = new Zend_Reflection_Class('Zend_Reflection_TestSampleClass5');
     $paramTag = $classReflection->getMethod('doSomething')->getDocblock()->getTag('return');
     $this->assertEquals($paramTag->getType(), 'mixed');
 }
开发者ID:jorgenils,项目名称:zend-framework,代码行数:6,代码来源:ReturnTest.php

示例12: document

 /**
  * Document a web service along with its response
  *
  * @param string $classname The service class name
  * @param string $methodname The service method name
  * @param string $response The server response
  * @return string
  * @author Mark Nielsen
  */
 public function document($classname, $methodname, $response)
 {
     $markup = '';
     if (!empty($methodname)) {
         mr_bootstrap::zend();
         require_once 'Zend/Reflection/Class.php';
         $class = new Zend_Reflection_Class($classname);
         $method = $class->getMethod($methodname);
         $phpdoc = $method->getDocblock();
         $params = $method->getParameters();
         $description = $phpdoc->getShortDescription();
         $longdesc = $phpdoc->getLongDescription();
         if (!empty($longdesc)) {
             $description .= "\n{$longdesc}";
         }
         $markup .= "h2. {$methodname}\n";
         $markup .= "*Description:*\n{$description}\n\n";
         $markup .= "*Parameters:*\n";
         $markup .= "* _string_ *method*: (Required) Must be set to '{$methodname}'\n";
         /** @var $params Zend_Reflection_Parameter[] */
         foreach ($params as $param) {
             $name = $param->getName();
             $tags = $phpdoc->getTags('param');
             if (isset($tags[$param->getPosition()])) {
                 $tag = $tags[$param->getPosition()];
                 $typestr = '_' . $tag->getType() . '_ ';
                 $descstr = $tag->getDescription();
             } else {
                 $typestr = $descstr = '';
             }
             if ($param->isOptional() and $param->isDefaultValueAvailable()) {
                 $default = $param->getDefaultValue();
                 if (is_null($default)) {
                     $default = 'NULL';
                 } else {
                     if (!is_numeric($default) and is_string($default)) {
                         $default = "'{$default}'";
                     }
                 }
                 $descstr = "(Optional, default = {$default}) {$descstr}";
             } else {
                 if ($param->isOptional()) {
                     $descstr = "(Optional) {$descstr}";
                 } else {
                     $descstr = "(Required) {$descstr}";
                 }
             }
             $markup .= "* {$typestr}*{$name}*: {$descstr}\n";
         }
         $markup .= "\n*Example Response:*\n";
         if ($simplexml = @simplexml_load_string($response)) {
             $dom = dom_import_simplexml($simplexml)->ownerDocument;
             $dom->formatOutput = true;
             $markup .= "{code:xml}\n";
             $markup .= trim($dom->saveXML());
             $markup .= "\n{code}\n";
         } else {
             if (($json = json_decode($response)) !== NULL) {
                 $markup .= "{noformat}\n";
                 $markup .= $response;
                 $markup .= "\n{noformat}\n\n";
                 $markup .= "*Example Response (decoded JSON):*\n";
                 $markup .= "{noformat}\n";
                 $markup .= trim(print_r($json, true));
                 $markup .= "\n{noformat}\n";
             } else {
                 $markup .= "{noformat}\n";
                 $markup .= trim($response);
                 $markup .= "\n{noformat}\n";
             }
         }
         $markup = $this->generalize_text($markup);
         // Add to overall markup string
         $this->markup .= "{$markup}\n\n";
     }
     return $markup;
 }
开发者ID:bgao-ca,项目名称:moodle-local_mr,代码行数:86,代码来源:testwebservice.php

示例13: testVariableName

 public function testVariableName()
 {
     $classReflection = new Zend_Reflection_Class('Zend_Reflection_TestSampleClass5');
     $paramTag = $classReflection->getMethod('doSomething')->getDocblock()->getTag('param');
     $this->assertEquals($paramTag->getVariableName(), '$one');
 }
开发者ID:jorgenils,项目名称:zend-framework,代码行数:6,代码来源:ParamTest.php


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