Пример #1
0
 /**
  * Save file methods information to sysmap cache
  * 
  * @param string $fileName 
  */
 protected function getControllerMap($module, $alias, $className)
 {
     $class = new \Zend\Code\Reflection\ClassReflection($className);
     if ($class->isSubclassOf('\\Zend\\Mvc\\Controller\\ActionController')) {
         $controller = new \Zend\Config\Config(array(), true);
         $controller->level = 2;
         if ('' != $class->getDocComment()) {
             $controller->longDescr = $class->getDocblock()->getLongDescription();
             $controller->shortDescr = $class->getDocblock()->getShortDescription();
         }
         $toDashFilter = new \Zend\Filter\Word\CamelCaseToDash();
         $controller->name = $alias;
         $controller->module = $module;
         $controller->hash = md5($controller->module . '.' . $controller->name . '.*');
         $actions = array();
         foreach ($class->getMethods() as $method) {
             if ($method instanceof \Zend\Code\Reflection\MethodReflection) {
                 $methodName = $method->getName();
                 if (strstr($method->getName(), $this->_actionSuffix) && !in_array($method->getName(), $this->skipedActions)) {
                     $addIt = true;
                     $action = new \Zend\Config\Config(array(), true);
                     $action->level = 3;
                     $action->name = strtolower($toDashFilter->filter(str_replace($this->_actionSuffix, '', $methodName)));
                     $action->hash = md5($controller->module . '.' . $controller->name . '.' . $action->name);
                     if ($method->getDocBlock() !== false) {
                         $docBlock = $method->getDocblock();
                         $action->shortDescr = $docBlock->getShortDescription();
                         $action->longDescr = $docBlock->getLongDescription();
                         foreach ($docBlock->getTags() as $tag) {
                             if ($tag->getName() == $this->_paramFormTag) {
                                 $action->{$this->_paramFormTag} = trim(str_replace('@' . $this->_paramFormTag, '', $tag->returnValue(0)));
                             }
                             if ($tag->getName() == $this->_hiddenFormTag) {
                                 $addIt = false;
                             }
                         }
                     }
                     if ($addIt) {
                         $actions[$action->name] = $action;
                     }
                 }
             }
         }
         $controller->_childrens = $actions;
     } else {
         return false;
     }
     return $controller;
 }