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


PHP Zend_Reflection_Class::getMethods方法代码示例

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


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

示例1: fromReflection

 /**
  * fromReflection() - build a Code Generation PHP Object from a Class Reflection
  *
  * @param Zend_Reflection_Class $reflectionClass
  * @return dmZendCodeGeneratorPhpClass
  */
 public static function fromReflection(Zend_Reflection_Class $reflectionClass)
 {
     $class = new self();
     $class->setSourceContent($class->getSourceContent());
     $class->setSourceDirty(false);
     if ($reflectionClass->getDocComment() != '') {
         $class->setDocblock(Zend_CodeGenerator_Php_Docblock::fromReflection($reflectionClass->getDocblock()));
     }
     $class->setAbstract($reflectionClass->isAbstract());
     $class->setName($reflectionClass->getName());
     if ($parentClass = $reflectionClass->getParentClass()) {
         $class->setExtendedClass($parentClass->getName());
         $interfaces = array_diff($parentClass->getInterfaces(), $reflectionClass->getInterfaces());
     } else {
         $interfaces = $reflectionClass->getInterfaces();
     }
     $class->setImplementedInterfaces($interfaces);
     $properties = array();
     foreach ($reflectionClass->getProperties() as $reflectionProperty) {
         if ($reflectionProperty->getDeclaringClass()->getName() == $class->getName()) {
             $properties[] = Zend_CodeGenerator_Php_Property::fromReflection($reflectionProperty);
         }
     }
     $class->setProperties($properties);
     $methods = array();
     foreach ($reflectionClass->getMethods(-1, 'dmZendReflectionMethod') as $reflectionMethod) {
         if ($reflectionMethod->getDeclaringClass()->getName() == $class->getName()) {
             $methods[] = dmZendCodeGeneratorPhpMethod::fromReflection($reflectionMethod);
         }
     }
     $class->setMethods($methods);
     return $class;
 }
开发者ID:theolymp,项目名称:diem,代码行数:39,代码来源:Class.php

示例2: 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

示例3: _processActionableMethods

 /**
  * _processActionableMethods() - process all methods that can be called on this provider.
  *
  */
 protected function _processActionableMethods()
 {
     $specialtyRegex = '#(.*)(' . implode('|', $this->_specialties) . ')$#i';
     $methods = $this->_providerReflection->getMethods();
     $actionableMethods = array();
     foreach ($methods as $method) {
         $methodName = $method->getName();
         /**
          * the following will determine what methods are actually actionable
          * public, non-static, non-underscore prefixed, classes that dont
          * contain the name "
          */
         if (!$method->getDeclaringClass()->isInstantiable() || !$method->isPublic() || $methodName[0] == '_' || $method->isStatic() || in_array($methodName, array('getContextClasses', 'getName'))) {
             continue;
         }
         /**
          * check to see if the method was a required method by a Zend_Tool_* interface
          */
         foreach ($method->getDeclaringClass()->getInterfaces() as $methodDeclaringClassInterface) {
             if (strpos($methodDeclaringClassInterface->getName(), 'Zend_Tool_') === 0 && $methodDeclaringClassInterface->hasMethod($methodName)) {
                 continue 2;
             }
         }
         $actionableName = ucfirst($methodName);
         if (substr($actionableName, -6) == 'Action') {
             $actionableName = substr($actionableName, 0, -6);
         }
         $actionableMethods[$methodName]['methodName'] = $methodName;
         $matches = null;
         if (preg_match($specialtyRegex, $actionableName, $matches)) {
             $actionableMethods[$methodName]['actionName'] = $matches[1];
             $actionableMethods[$methodName]['specialty'] = $matches[2];
         } else {
             $actionableMethods[$methodName]['actionName'] = $actionableName;
             $actionableMethods[$methodName]['specialty'] = '_Global';
         }
         // get the action, and create non-existent actions when they dont exist (the true part below)
         $action = $this->_registry->getActionRepository()->getAction($actionableMethods[$methodName]['actionName']);
         if ($action == null) {
             $action = new Zend_Tool_Framework_Action_Base($actionableMethods[$methodName]['actionName']);
             $this->_registry->getActionRepository()->addAction($action);
         }
         $actionableMethods[$methodName]['action'] = $action;
         if (!in_array($actionableMethods[$methodName]['action'], $this->_actions)) {
             $this->_actions[] = $actionableMethods[$methodName]['action'];
         }
         $parameterInfo = array();
         $position = 1;
         foreach ($method->getParameters() as $parameter) {
             $currentParam = $parameter->getName();
             $parameterInfo[$currentParam]['position'] = $position++;
             $parameterInfo[$currentParam]['optional'] = $parameter->isOptional();
             $parameterInfo[$currentParam]['default'] = $parameter->isOptional() ? $parameter->getDefaultValue() : null;
             $parameterInfo[$currentParam]['name'] = $currentParam;
             $parameterInfo[$currentParam]['type'] = 'string';
             $parameterInfo[$currentParam]['description'] = null;
         }
         $matches = null;
         if (($docComment = $method->getDocComment()) != '' && preg_match_all('/@param\\s+(\\w+)+\\s+(\\$\\S+)\\s+(.*?)(?=(?:\\*\\s*@)|(?:\\*\\/))/s', $docComment, $matches)) {
             for ($i = 0; $i <= count($matches[0]) - 1; $i++) {
                 $currentParam = ltrim($matches[2][$i], '$');
                 if ($currentParam != '' && isset($parameterInfo[$currentParam])) {
                     $parameterInfo[$currentParam]['type'] = $matches[1][$i];
                     $descriptionSource = $matches[3][$i];
                     if ($descriptionSource != '') {
                         $parameterInfo[$currentParam]['description'] = trim($descriptionSource);
                     }
                 }
             }
         }
         $actionableMethods[$methodName]['parameterInfo'] = $parameterInfo;
     }
     $this->_actionableMethods = $actionableMethods;
 }
开发者ID:bitExpert,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:78,代码来源:Signature.php

示例4: getActions

 /**
  * Get all defined actions for a module/controller combination from the sources
  *
  * Scan the Controller in a module for actions.
  * The scanning is pure on the source and the nameing convention, which means
  * only methods in the controller that fit the format
  *          [name]Action
  * will be used as action
  *
  * For a little bit more comfort, the DocString will be used as description
  * of the Action.
  *
  * Returning result is an array of Admin_Model_DbRow_Action elements
  *
  * @return array
  */
 public function getActions($modul, $controller)
 {
     $actions = array();
     $className = ucfirst($modul) . '_Model_Modules_' . ucfirst($controller);
     $classFile = ucfirst($controller) . '.php';
     if (file_exists($this->path . $classFile)) {
         // load the file
         require_once $this->path . $classFile;
         $reflect = new Zend_Reflection_Class($className);
         foreach ($reflect->getMethods() as $method) {
             if (preg_match('/(\\w+)Action$/', $method->getName(), $match)) {
                 $actionComment = $method->getName();
                 $name = $match[1];
                 $docComment = $method->getDocComment();
                 if (is_string($docComment)) {
                     $commentRows = explode("\n", $docComment);
                     $actionComment = preg_replace("/^\\s*\\*\\s*(.*)\\s*/", '$1', $commentRows[1]);
                     if ($actionComment === "") {
                         $actionComment = $docComment;
                     }
                 }
                 $actions[] = new Admin_Model_DbRow_Action(array('actionName' => $name, 'description' => $actionComment));
             }
         }
     }
     return $actions;
 }
开发者ID:kevindragon221,项目名称:Webdesktop,代码行数:43,代码来源:Webdesktop.php

示例5: array

<?php

$tt = array('' => '[ не указан ]');
$data = Zkernel_Common::getControllerDocblock();
if ($data) {
    foreach ($data as $n => $db) {
        $nn = $n;
        $c = ucfirst($n) . 'Controller';
        if (isset($db['zk_title'])) {
            $nn = $db['zk_title'];
        }
        $inner = array();
        $r = new Zend_Reflection_Class($c);
        $met = $r->getMethods();
        if (@$met) {
            $exist = false;
            foreach ($met as $el) {
                if ($el->name == '_getRoutes') {
                    $rq = new Zend_Controller_Request_Http();
                    $rq->setControllerName($n);
                    $ci = new $c($rq, new Zend_Controller_Response_Http());
                    $ci->init();
                    $rs = $ci->_getRoutes();
                    if ($rs) {
                        foreach ($rs as $k_1 => $el_1) {
                            $is_route = strpos($k_1, '|');
                            $ap = 'index';
                            $pp = explode('@', $k_1);
                            if (count($pp) == 2) {
                                $ap = $pp[0];
                                $k_1 = $pp[1];
开发者ID:s-kalaus,项目名称:zkernel,代码行数:31,代码来源:menu.php

示例6: getActions

 /**
  * Get all Actions for a modul / controller
  *
  * Method scans modul/controller for actions, which have the Zend Framework
  * action method namespacing, like "indexAction".
  *
  * @param string $modul
  * @param string $controller
  * @return array
  * @access public
  */
 public function getActions($modul, $controller, $virtual)
 {
     $actions = array();
     if ($virtual == 0) {
         $frontController = Zend_Controller_Front::getInstance();
         $className = ucfirst($modul) . '_' . ucfirst($controller) . 'Controller';
         $classFile = ucfirst($controller) . 'Controller.php';
         $directory = $frontController->getControllerDirectory($modul);
         if (file_exists($directory . '/' . $classFile) === FALSE) {
             throw new Admin_Model_Acl_Exception('Controller file could not be found');
         }
         require_once $directory . '/' . $classFile;
         $reflect = new Zend_Reflection_Class($className);
         $CcFilter = new Zend_Filter_Word_CamelCaseToDash();
         foreach ($reflect->getMethods() as $method) {
             if (preg_match('/(\\w+)Action$/', $method->getName(), $match)) {
                 $actionComment = $method->getName();
                 $name = $match[1];
                 $docComment = $method->getDocComment();
                 if (is_string($docComment)) {
                     $commentRows = explode("\n", $docComment);
                     $actionComment = preg_replace("/^\\s*\\*\\s*(.*)\\s*/", '$1', $commentRows[1]);
                     if ($actionComment === "") {
                         $actionComment = $docComment;
                     }
                 }
                 $actions[] = new Admin_Model_DbRow_Action(array('actionName' => strtolower($CcFilter->filter($name)), 'description' => $actionComment));
             }
         }
     } else {
         foreach ($this->hooks as $hook) {
             foreach ($hook->getActions($modul, $controller) as $hAction) {
                 $actions[] = $hAction;
             }
             //$actions = array_merge_recursive($actions, $hook->getActions($modul, $controller));
         }
     }
     return $actions;
 }
开发者ID:kevindragon221,项目名称:Webdesktop,代码行数:50,代码来源:ControllersActions.php


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