コード例 #1
0
ファイル: Builder.php プロジェクト: gushou/codeigniter-apidoc
 /**
  * Extract annotations
  *
  * @return array
  */
 protected function extractAnnotations()
 {
     foreach ($this->_st_classes as $class) {
         $st_output[] = Extractor::getAllClassAnnotations($class);
     }
     return end($st_output);
 }
コード例 #2
0
ファイル: cli.php プロジェクト: ParisPar/learning-phalcon
 public function readTasks()
 {
     if ($handle = opendir(__DIR__ . '/Task/')) {
         require_once __DIR__ . '/Task/BaseTask.php';
         $util = new BaseTask();
         $util->consoleLog('Learning Phalcon CLI', 'grey');
         $util->consoleLog(str_repeat('-', 80), 'grey');
         while (false !== ($entry = readdir($handle))) {
             if ($entry != '.' && $entry != '..' && $entry != 'BaseTask.php' && preg_match("/\\.php\$/", $entry)) {
                 $entries[] = $entry;
             }
         }
         asort($entries);
         $charCountActionName = 0;
         foreach ($entries as $entry) {
             $task = str_replace('Task.php', '', $entry);
             require_once __DIR__ . '/Task/' . $entry;
             $tmp_className = str_replace('.php', '', $entry);
             $tmp = new $tmp_className();
             $taskName = PHP_EOL . strtolower(preg_replace('/\\B([A-Z])/', '_$1', $task));
             $taskDescription = '';
             $util->consoleLog(str_pad($taskName, 25) . $taskDescription, 'yellow');
             $st_classMethods = get_class_methods($tmp);
             asort($st_classMethods);
             foreach ($st_classMethods as $value) {
                 if (preg_match('/Action/', $value)) {
                     $theActionName = str_pad(str_replace('Action', '', $value), 6);
                     if (strlen($theActionName) > $charCountActionName) {
                         $charCountActionName = strlen($theActionName);
                     }
                 }
             }
             foreach ($st_classMethods as $value) {
                 if (preg_match('/Action/', $value)) {
                     $theActionName = str_replace('Action', '', $value);
                     $theActionDescription = '';
                     $annotations = Extractor::getMethodAnnotations($tmp_className, $value);
                     if (count($annotations) > 0) {
                         foreach ($annotations as $key => $st_values) {
                             if ($key == 'Description') {
                                 $theActionDescription .= implode(', ', $st_values);
                             }
                         }
                     }
                     $util->consoleLog(str_pad($theActionName, $charCountActionName + 5) . "" . $theActionDescription, 'green');
                 }
             }
         }
         closedir($handle);
     }
 }