import v2.0.0.0_RC3 | 2012-07-01
https://github.com/lucanos/CommunityID -> http://www.itadmins.net/archives/357
This commit is contained in:
@ -16,7 +16,7 @@
|
||||
* @package Zend_Reflection
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Docblock.php 16971 2009-07-22 18:05:45Z mikaelkael $
|
||||
* @version $Id: Docblock.php 18951 2009-11-12 16:26:19Z alexander $
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -36,39 +36,39 @@ class Zend_Reflection_Docblock implements Reflector
|
||||
* @var Reflector
|
||||
*/
|
||||
protected $_reflector = null;
|
||||
|
||||
|
||||
/**#@+
|
||||
* @var int
|
||||
*/
|
||||
protected $_startLine = null;
|
||||
protected $_endLine = null;
|
||||
/**#@-*/
|
||||
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $_docComment = null;
|
||||
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $_cleanDocComment = null;
|
||||
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $_longDescription = null;
|
||||
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $_shortDescription = null;
|
||||
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $_tags = array();
|
||||
|
||||
|
||||
/**
|
||||
* Export reflection
|
||||
*
|
||||
@ -79,8 +79,9 @@ class Zend_Reflection_Docblock implements Reflector
|
||||
*/
|
||||
public static function export()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Serialize to string
|
||||
*
|
||||
@ -91,8 +92,19 @@ class Zend_Reflection_Docblock implements Reflector
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
$str = "Docblock [ /* Docblock */ ] {".PHP_EOL.PHP_EOL;
|
||||
$str .= " - Tags [".count($this->_tags)."] {".PHP_EOL;
|
||||
|
||||
foreach($this->_tags AS $tag) {
|
||||
$str .= " ".$tag;
|
||||
}
|
||||
|
||||
$str .= " }".PHP_EOL;
|
||||
$str .= "}".PHP_EOL;
|
||||
|
||||
return $str;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
@ -107,28 +119,28 @@ class Zend_Reflection_Docblock implements Reflector
|
||||
throw new Zend_Reflection_Exception('Reflector must contain method "getDocComment"');
|
||||
}
|
||||
$docComment = $commentOrReflector->getDocComment();
|
||||
|
||||
|
||||
$lineCount = substr_count($docComment, "\n");
|
||||
|
||||
|
||||
$this->_startLine = $this->_reflector->getStartLine() - $lineCount - 1;
|
||||
$this->_endLine = $this->_reflector->getStartLine() - 1;
|
||||
|
||||
|
||||
} elseif (is_string($commentOrReflector)) {
|
||||
$docComment = $commentOrReflector;
|
||||
} else {
|
||||
require_once 'Zend/Reflection/Exception.php';
|
||||
throw new Zend_Reflection_Exception(get_class($this) . ' must have a (string) DocComment or a Reflector in the constructor');
|
||||
}
|
||||
|
||||
|
||||
if ($docComment == '') {
|
||||
require_once 'Zend/Reflection/Exception.php';
|
||||
throw new Zend_Reflection_Exception('DocComment cannot be empty');
|
||||
}
|
||||
|
||||
|
||||
$this->_docComment = $docComment;
|
||||
$this->_parse();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Retrieve contents of docblock
|
||||
*
|
||||
@ -138,7 +150,7 @@ class Zend_Reflection_Docblock implements Reflector
|
||||
{
|
||||
return $this->_cleanDocComment;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get start line (position) of docblock
|
||||
*
|
||||
@ -148,7 +160,7 @@ class Zend_Reflection_Docblock implements Reflector
|
||||
{
|
||||
return $this->_startLine;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get last line (position) of docblock
|
||||
*
|
||||
@ -158,7 +170,7 @@ class Zend_Reflection_Docblock implements Reflector
|
||||
{
|
||||
return $this->_endLine;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get docblock short description
|
||||
*
|
||||
@ -168,7 +180,7 @@ class Zend_Reflection_Docblock implements Reflector
|
||||
{
|
||||
return $this->_shortDescription;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get docblock long description
|
||||
*
|
||||
@ -178,7 +190,7 @@ class Zend_Reflection_Docblock implements Reflector
|
||||
{
|
||||
return $this->_longDescription;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Does the docblock contain the given annotation tag?
|
||||
*
|
||||
@ -194,7 +206,7 @@ class Zend_Reflection_Docblock implements Reflector
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Retrieve the given docblock tag
|
||||
*
|
||||
@ -208,10 +220,10 @@ class Zend_Reflection_Docblock implements Reflector
|
||||
return $tag;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get all docblock annotation tags
|
||||
*
|
||||
@ -223,7 +235,7 @@ class Zend_Reflection_Docblock implements Reflector
|
||||
if ($filter === null || !is_string($filter)) {
|
||||
return $this->_tags;
|
||||
}
|
||||
|
||||
|
||||
$returnTags = array();
|
||||
foreach ($this->_tags as $tag) {
|
||||
if ($tag->getName() == $filter) {
|
||||
@ -232,7 +244,7 @@ class Zend_Reflection_Docblock implements Reflector
|
||||
}
|
||||
return $returnTags;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Parse the docblock
|
||||
*
|
||||
@ -241,22 +253,22 @@ class Zend_Reflection_Docblock implements Reflector
|
||||
protected function _parse()
|
||||
{
|
||||
$docComment = $this->_docComment;
|
||||
|
||||
|
||||
// First remove doc block line starters
|
||||
$docComment = preg_replace('#[ \t]*(?:\/\*\*|\*\/|\*)?[ ]{0,1}(.*)?#', '$1', $docComment);
|
||||
$docComment = ltrim($docComment, "\r\n"); // @todo should be changed to remove first and last empty line
|
||||
|
||||
|
||||
$this->_cleanDocComment = $docComment;
|
||||
|
||||
|
||||
// Next parse out the tags and descriptions
|
||||
$parsedDocComment = $docComment;
|
||||
$lineNumber = $firstBlandLineEncountered = 0;
|
||||
while (($newlinePos = strpos($parsedDocComment, "\n")) !== false) {
|
||||
$lineNumber++;
|
||||
$line = substr($parsedDocComment, 0, $newlinePos);
|
||||
|
||||
|
||||
$matches = array();
|
||||
|
||||
|
||||
if ((strpos($line, '@') === 0) && (preg_match('#^(@\w+.*?)(\n)(?:@|\r?\n|$)#s', $parsedDocComment, $matches))) {
|
||||
$this->_tags[] = Zend_Reflection_Docblock_Tag::factory($matches[1]);
|
||||
$parsedDocComment = str_replace($matches[1] . $matches[2], '', $parsedDocComment);
|
||||
@ -266,14 +278,14 @@ class Zend_Reflection_Docblock implements Reflector
|
||||
} else {
|
||||
$this->_longDescription .= $line . "\n";
|
||||
}
|
||||
|
||||
|
||||
if ($line == '') {
|
||||
$firstBlandLineEncountered = true;
|
||||
}
|
||||
|
||||
|
||||
$parsedDocComment = substr($parsedDocComment, $newlinePos + 1);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
$this->_shortDescription = rtrim($this->_shortDescription);
|
||||
|
Reference in New Issue
Block a user