示例#1
0
文件: File.php 项目: rhysr/Docblox
 /**
  * Is the docblock valid?
  *
  * @see DocBlox_Core_Validator::isValid()
  *
  * @return boolean
  */
 public function isValid()
 {
     $valid = true;
     if (null == $this->docblock) {
         return false;
     }
     if (!$this->docblock->hasTag('package')) {
         $valid = false;
         $this->log('No Page-level DocBlock was found for ' . $this->filename . ' on line: ' . $this->lineNumber, Zend_Log::ERR);
     }
     if (count($this->docblock->getTagsByName('package')) > 1) {
         $this->log('File cannot have more than one @package tag in ' . $this->filename, Zend_Log::CRIT);
     }
     if ($this->docblock->hasTag('subpackage') && !$this->docblock->hasTag('package')) {
         $this->log('File cannot have a @subpackage when a @package tag is not present in ' . $this->filename, Zend_Log::CRIT);
     }
     return $valid;
 }
示例#2
0
 /**
  * Returns the usage description or null if none is set.
  *
  * @return string|null
  */
 public function getUsageDescription()
 {
     if ($this->usage_description === null) {
         $refl = new DocBlox_Reflection_DocBlock(new ReflectionObject($this));
         $this->usage_description = $refl->getLongDescription()->getContents();
     }
     return $this->usage_description;
 }
示例#3
0
";
$prev_chanotype = false;
foreach ($methods as $method) {
    $rf_method = new ReflectionMethod('Chano', $method);
    $docblox = new DocBlox_Reflection_DocBlock($rf_method->getDocComment());
    $short = $docblox->getShortDescription();
    if (empty($short)) continue;
    $chanotype_tag = $docblox->getTagsByName('chanotype');
    if (empty($chanotype_tag)) continue;
    preg_match("#function ($method\(.*\))#Uis", $chano_src, $ms);
    $method_sig = $ms[1];
    $chanotype = $chanotype_tag[0]->getContent();
    if (empty($prev_chanotype) || $prev_chanotype != $chanotype) {
        preg_match("#/\*\*\n     \* @section $chanotype.*\*/#Uis", $chano_src, $ms);
        if (!empty($ms)) {
            $db = new DocBlox_Reflection_DocBlock($ms[0]);
            $_tags = $db->getTagsByName('section');
            $lines = explode("\n", $_tags[0]->getDescription());
            array_shift($lines);
            $headline = array_shift($lines);
            array_unshift($lines, "");
            array_unshift($lines, str_repeat('_', strlen($headline)));
            array_unshift($lines, $headline);
            $rst .= "\n" . implode("\n", $lines) . "\n\n";
        }
        
    }


    ob_start();