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: Class.php 16971 2009-07-22 18:05:45Z mikaelkael $
|
||||
* @version $Id: Class.php 18951 2009-11-12 16:26:19Z alexander $
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -56,7 +56,7 @@ class Zend_Reflection_Class extends ReflectionClass
|
||||
}
|
||||
return $instance;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return the classes Docblock reflection object
|
||||
*
|
||||
@ -78,7 +78,7 @@ class Zend_Reflection_Class extends ReflectionClass
|
||||
}
|
||||
return $instance;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return the start line of the class
|
||||
*
|
||||
@ -92,10 +92,10 @@ class Zend_Reflection_Class extends ReflectionClass
|
||||
return $this->getDocblock()->getStartLine();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return parent::getStartLine();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return the contents of the class
|
||||
*
|
||||
@ -108,10 +108,10 @@ class Zend_Reflection_Class extends ReflectionClass
|
||||
$filelines = file($filename);
|
||||
$startnum = $this->getStartLine($includeDocblock);
|
||||
$endnum = $this->getEndLine() - $this->getStartLine();
|
||||
|
||||
|
||||
return implode('', array_splice($filelines, $startnum, $endnum, true));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get all reflection objects of implemented interfaces
|
||||
*
|
||||
@ -134,7 +134,7 @@ class Zend_Reflection_Class extends ReflectionClass
|
||||
unset($phpReflections);
|
||||
return $zendReflections;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return method reflection by name
|
||||
*
|
||||
@ -220,7 +220,7 @@ class Zend_Reflection_Class extends ReflectionClass
|
||||
unset($phpReflection);
|
||||
return $zendReflection;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return reflection properties of this class
|
||||
*
|
||||
|
@ -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);
|
||||
|
@ -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: Tag.php 16971 2009-07-22 18:05:45Z mikaelkael $
|
||||
* @version $Id: Tag.php 18951 2009-11-12 16:26:19Z alexander $
|
||||
*/
|
||||
|
||||
/** Zend_Loader */
|
||||
@ -42,7 +42,7 @@ class Zend_Reflection_Docblock_Tag implements Reflector
|
||||
* @var string
|
||||
*/
|
||||
protected $_name = null;
|
||||
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
@ -57,8 +57,8 @@ class Zend_Reflection_Docblock_Tag implements Reflector
|
||||
public static function factory($tagDocblockLine)
|
||||
{
|
||||
$matches = array();
|
||||
|
||||
if (!preg_match('#^@(\w+)\s#', $tagDocblockLine, $matches)) {
|
||||
|
||||
if (!preg_match('#^@(\w+)(\s|$)#', $tagDocblockLine, $matches)) {
|
||||
require_once 'Zend/Reflection/Exception.php';
|
||||
throw new Zend_Reflection_Exception('No valid tag name found within provided docblock line.');
|
||||
}
|
||||
@ -73,7 +73,7 @@ class Zend_Reflection_Docblock_Tag implements Reflector
|
||||
}
|
||||
return new self($tagDocblockLine);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Export reflection
|
||||
*
|
||||
@ -85,7 +85,7 @@ class Zend_Reflection_Docblock_Tag implements Reflector
|
||||
public static function export()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Serialize to string
|
||||
*
|
||||
@ -96,8 +96,11 @@ class Zend_Reflection_Docblock_Tag implements Reflector
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
$str = "Docblock Tag [ * @".$this->_name." ]".PHP_EOL;
|
||||
|
||||
return $str;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
@ -109,17 +112,17 @@ class Zend_Reflection_Docblock_Tag implements Reflector
|
||||
$matches = array();
|
||||
|
||||
// find the line
|
||||
if (!preg_match('#^@(\w+)\s(.*)?#', $tagDocblockLine, $matches)) {
|
||||
if (!preg_match('#^@(\w+)(?:\s+([^\s].*)|$)?#', $tagDocblockLine, $matches)) {
|
||||
require_once 'Zend/Reflection/Exception.php';
|
||||
throw new Zend_Reflection_Exception('Provided docblock line does not contain a valid tag');
|
||||
}
|
||||
|
||||
$this->_name = $matches[1];
|
||||
if ($matches[2]) {
|
||||
if (isset($matches[2]) && $matches[2]) {
|
||||
$this->_description = $matches[2];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get annotation tag name
|
||||
*
|
||||
@ -129,7 +132,7 @@ class Zend_Reflection_Docblock_Tag implements Reflector
|
||||
{
|
||||
return $this->_name;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get annotation tag description
|
||||
*
|
||||
|
@ -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: Param.php 16971 2009-07-22 18:05:45Z mikaelkael $
|
||||
* @version $Id: Param.php 19062 2009-11-19 21:04:08Z beberlei $
|
||||
*/
|
||||
|
||||
/** Zend_Reflection_Docblock_Tag */
|
||||
@ -34,12 +34,12 @@ class Zend_Reflection_Docblock_Tag_Param extends Zend_Reflection_Docblock_Tag
|
||||
* @var string
|
||||
*/
|
||||
protected $_type = null;
|
||||
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $_variableName = null;
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
@ -48,29 +48,29 @@ class Zend_Reflection_Docblock_Tag_Param extends Zend_Reflection_Docblock_Tag
|
||||
public function __construct($tagDocblockLine)
|
||||
{
|
||||
$matches = array();
|
||||
|
||||
if (!preg_match('#^@(\w+)\s(\w+)(?:\s(\$\S+))?(?:\s(.*))?#s', $tagDocblockLine, $matches)) {
|
||||
|
||||
if (!preg_match('#^@(\w+)\s+([\w|\\\]+)(?:\s+(\$\S+))?(?:\s+(.*))?#s', $tagDocblockLine, $matches)) {
|
||||
require_once 'Zend/Reflection/Exception.php';
|
||||
throw new Zend_Reflection_Exception('Provided docblock line is does not contain a valid tag');
|
||||
}
|
||||
|
||||
|
||||
if ($matches[1] != 'param') {
|
||||
require_once 'Zend/Reflection/Exception.php';
|
||||
throw new Zend_Reflection_Exception('Provided docblock line is does not contain a valid @param tag');
|
||||
}
|
||||
|
||||
|
||||
$this->_name = 'param';
|
||||
$this->_type = $matches[2];
|
||||
|
||||
|
||||
if (isset($matches[3])) {
|
||||
$this->_variableName = $matches[3];
|
||||
}
|
||||
|
||||
|
||||
if (isset($matches[4])) {
|
||||
$this->_description = preg_replace('#\s+#', ' ', $matches[4]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get parameter variable type
|
||||
*
|
||||
@ -80,7 +80,7 @@ class Zend_Reflection_Docblock_Tag_Param extends Zend_Reflection_Docblock_Tag
|
||||
{
|
||||
return $this->_type;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get parameter name
|
||||
*
|
||||
|
@ -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: Return.php 16971 2009-07-22 18:05:45Z mikaelkael $
|
||||
* @version $Id: Return.php 19062 2009-11-19 21:04:08Z beberlei $
|
||||
*/
|
||||
|
||||
/** Zend_Reflection_Docblock_Tag */
|
||||
@ -34,7 +34,7 @@ class Zend_Reflection_Docblock_Tag_Return extends Zend_Reflection_Docblock_Tag
|
||||
* @var string
|
||||
*/
|
||||
protected $_type = null;
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
@ -43,23 +43,23 @@ class Zend_Reflection_Docblock_Tag_Return extends Zend_Reflection_Docblock_Tag
|
||||
*/
|
||||
public function __construct($tagDocblockLine)
|
||||
{
|
||||
if (!preg_match('#^@(\w+)\s(\w+)(?:\s(.*))?#', $tagDocblockLine, $matches)) {
|
||||
if (!preg_match('#^@(\w+)\s+([\w|\\\]+)(?:\s+(.*))?#', $tagDocblockLine, $matches)) {
|
||||
require_once 'Zend/Reflection/Exception.php';
|
||||
throw new Zend_Reflection_Exception('Provided docblock line is does not contain a valid tag');
|
||||
}
|
||||
|
||||
|
||||
if ($matches[1] != 'return') {
|
||||
require_once 'Zend/Reflection/Exception.php';
|
||||
throw new Zend_Reflection_Exception('Provided docblock line is does not contain a valid @return tag');
|
||||
}
|
||||
|
||||
|
||||
$this->_name = 'return';
|
||||
$this->_type = $matches[2];
|
||||
if (isset($matches[3])) {
|
||||
$this->_description = $matches[3];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get return variable type
|
||||
*
|
||||
|
@ -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: Exception.php 16971 2009-07-22 18:05:45Z mikaelkael $
|
||||
* @version $Id: Exception.php 18951 2009-11-12 16:26:19Z alexander $
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -32,5 +32,5 @@ require_once 'Zend/Exception.php';
|
||||
*/
|
||||
class Zend_Reflection_Exception extends Zend_Exception
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
@ -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: Extension.php 16971 2009-07-22 18:05:45Z mikaelkael $
|
||||
* @version $Id: Extension.php 18951 2009-11-12 16:26:19Z alexander $
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -59,7 +59,7 @@ class Zend_Reflection_Extension extends ReflectionExtension
|
||||
unset($phpReflections);
|
||||
return $zendReflections;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get extension class reflection objects
|
||||
*
|
||||
|
@ -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: File.php 17516 2009-08-10 13:50:26Z ralph $
|
||||
* @version $Id: File.php 18951 2009-11-12 16:26:19Z alexander $
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -41,37 +41,37 @@ class Zend_Reflection_File implements Reflector
|
||||
* @var string
|
||||
*/
|
||||
protected $_filepath = null;
|
||||
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $_docComment = null;
|
||||
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
protected $_startLine = 1;
|
||||
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
protected $_endLine = null;
|
||||
|
||||
|
||||
/**
|
||||
* @var string[]
|
||||
*/
|
||||
protected $_requiredFiles = array();
|
||||
|
||||
|
||||
/**
|
||||
* @var Zend_Reflection_Class[]
|
||||
*/
|
||||
protected $_classes = array();
|
||||
|
||||
|
||||
/**
|
||||
* @var Zend_Reflection_Function[]
|
||||
*/
|
||||
protected $_functions = array();
|
||||
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
@ -83,7 +83,7 @@ class Zend_Reflection_File implements Reflector
|
||||
* @param string $file
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($file)
|
||||
public function __construct($file)
|
||||
{
|
||||
$fileName = $file;
|
||||
|
||||
@ -112,15 +112,15 @@ class Zend_Reflection_File implements Reflector
|
||||
$includePaths = explode(PATH_SEPARATOR, get_include_path());
|
||||
while (count($includePaths) > 0) {
|
||||
$filePath = array_shift($includePaths) . DIRECTORY_SEPARATOR . $fileName;
|
||||
|
||||
|
||||
if ( ($foundRealpath = realpath($filePath)) !== false) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return $foundRealpath;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Export
|
||||
*
|
||||
@ -133,7 +133,7 @@ class Zend_Reflection_File implements Reflector
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return the file name of the reflected file
|
||||
*
|
||||
@ -143,7 +143,7 @@ class Zend_Reflection_File implements Reflector
|
||||
{
|
||||
return $this->_fileName;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the start line - Always 1, staying consistent with the Reflection API
|
||||
*
|
||||
@ -153,7 +153,7 @@ class Zend_Reflection_File implements Reflector
|
||||
{
|
||||
return $this->_startLine;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the end line / number of lines
|
||||
*
|
||||
@ -163,7 +163,7 @@ class Zend_Reflection_File implements Reflector
|
||||
{
|
||||
return $this->_endLine;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return the doc comment
|
||||
*
|
||||
@ -173,7 +173,7 @@ class Zend_Reflection_File implements Reflector
|
||||
{
|
||||
return $this->_docComment;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return the docblock
|
||||
*
|
||||
@ -189,7 +189,7 @@ class Zend_Reflection_File implements Reflector
|
||||
}
|
||||
return $instance;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return the reflection classes of the classes found inside this file
|
||||
*
|
||||
@ -209,8 +209,8 @@ class Zend_Reflection_File implements Reflector
|
||||
}
|
||||
return $classes;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
/**
|
||||
* Return the reflection functions of the functions found inside this file
|
||||
*
|
||||
* @param string $reflectionClass Name of reflection class to use for instances
|
||||
@ -229,7 +229,7 @@ class Zend_Reflection_File implements Reflector
|
||||
}
|
||||
return $functions;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Retrieve the reflection class of a given class found in this file
|
||||
*
|
||||
@ -250,7 +250,7 @@ class Zend_Reflection_File implements Reflector
|
||||
}
|
||||
return $instance;
|
||||
}
|
||||
|
||||
|
||||
if (in_array($name, $this->_classes)) {
|
||||
$instance = new $reflectionClass($name);
|
||||
if (!$instance instanceof Zend_Reflection_Class) {
|
||||
@ -259,7 +259,7 @@ class Zend_Reflection_File implements Reflector
|
||||
}
|
||||
return $instance;
|
||||
}
|
||||
|
||||
|
||||
require_once 'Zend/Reflection/Exception.php';
|
||||
throw new Zend_Reflection_Exception('Class by name ' . $name . ' not found.');
|
||||
}
|
||||
@ -273,7 +273,7 @@ class Zend_Reflection_File implements Reflector
|
||||
{
|
||||
return $this->_contents;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Serialize to string
|
||||
*
|
||||
@ -286,7 +286,7 @@ class Zend_Reflection_File implements Reflector
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This method does the work of "reflecting" the file
|
||||
*
|
||||
@ -298,27 +298,27 @@ class Zend_Reflection_File implements Reflector
|
||||
{
|
||||
$contents = $this->_contents;
|
||||
$tokens = token_get_all($contents);
|
||||
|
||||
|
||||
$functionTrapped = false;
|
||||
$classTrapped = false;
|
||||
$requireTrapped = false;
|
||||
$openBraces = 0;
|
||||
|
||||
|
||||
$this->_checkFileDocBlock($tokens);
|
||||
|
||||
|
||||
foreach ($tokens as $token) {
|
||||
/*
|
||||
* Tokens are characters representing symbols or arrays
|
||||
* representing strings. The keys/values in the arrays are
|
||||
* Tokens are characters representing symbols or arrays
|
||||
* representing strings. The keys/values in the arrays are
|
||||
*
|
||||
* - 0 => token id,
|
||||
* - 1 => string,
|
||||
* - 0 => token id,
|
||||
* - 1 => string,
|
||||
* - 2 => line number
|
||||
*
|
||||
* Token ID's are explained here:
|
||||
* Token ID's are explained here:
|
||||
* http://www.php.net/manual/en/tokens.php.
|
||||
*/
|
||||
|
||||
|
||||
if (is_array($token)) {
|
||||
$type = $token[0];
|
||||
$value = $token[1];
|
||||
@ -331,10 +331,10 @@ class Zend_Reflection_File implements Reflector
|
||||
} else if ($token == '}') {
|
||||
$openBraces--;
|
||||
}
|
||||
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
switch ($type) {
|
||||
// Name of something
|
||||
case T_STRING:
|
||||
@ -346,7 +346,7 @@ class Zend_Reflection_File implements Reflector
|
||||
$classTrapped = false;
|
||||
}
|
||||
continue;
|
||||
|
||||
|
||||
// Required file names are T_CONSTANT_ENCAPSED_STRING
|
||||
case T_CONSTANT_ENCAPSED_STRING:
|
||||
if ($requireTrapped) {
|
||||
@ -354,20 +354,20 @@ class Zend_Reflection_File implements Reflector
|
||||
$requireTrapped = false;
|
||||
}
|
||||
continue;
|
||||
|
||||
|
||||
// Functions
|
||||
case T_FUNCTION:
|
||||
if ($openBraces == 0) {
|
||||
$functionTrapped = true;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
// Classes
|
||||
case T_CLASS:
|
||||
case T_INTERFACE:
|
||||
$classTrapped = true;
|
||||
break;
|
||||
|
||||
|
||||
// All types of requires
|
||||
case T_REQUIRE:
|
||||
case T_REQUIRE_ONCE:
|
||||
@ -381,13 +381,13 @@ class Zend_Reflection_File implements Reflector
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$this->_endLine = count(explode("\n", $this->_contents));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Validate / check a file level docblock
|
||||
*
|
||||
*
|
||||
* @param array $tokens Array of tokenizer tokens
|
||||
* @return void
|
||||
*/
|
||||
|
@ -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: Function.php 16971 2009-07-22 18:05:45Z mikaelkael $
|
||||
* @version $Id: Function.php 18951 2009-11-12 16:26:19Z alexander $
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -51,7 +51,7 @@ class Zend_Reflection_Function extends ReflectionFunction
|
||||
}
|
||||
return $instance;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get start line (position) of function
|
||||
*
|
||||
@ -65,10 +65,10 @@ class Zend_Reflection_Function extends ReflectionFunction
|
||||
return $this->getDocblock()->getStartLine();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return parent::getStartLine();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get contents of function
|
||||
*
|
||||
@ -77,16 +77,16 @@ class Zend_Reflection_Function extends ReflectionFunction
|
||||
*/
|
||||
public function getContents($includeDocblock = true)
|
||||
{
|
||||
return implode("\n",
|
||||
return implode("\n",
|
||||
array_splice(
|
||||
file($this->getFileName()),
|
||||
$this->getStartLine($includeDocblock),
|
||||
($this->getEndLine() - $this->getStartLine()),
|
||||
$this->getStartLine($includeDocblock),
|
||||
($this->getEndLine() - $this->getStartLine()),
|
||||
true
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get function parameters
|
||||
*
|
||||
@ -109,7 +109,7 @@ class Zend_Reflection_Function extends ReflectionFunction
|
||||
unset($phpReflections);
|
||||
return $zendReflections;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get return type tag
|
||||
*
|
||||
|
@ -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: Method.php 16971 2009-07-22 18:05:45Z mikaelkael $
|
||||
* @version $Id: Method.php 18165 2009-09-17 13:24:09Z carlton $
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -62,7 +62,7 @@ class Zend_Reflection_Method extends ReflectionMethod
|
||||
}
|
||||
return $instance;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get start line (position) of method
|
||||
*
|
||||
@ -76,10 +76,10 @@ class Zend_Reflection_Method extends ReflectionMethod
|
||||
return $this->getDocblock()->getStartLine();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return parent::getStartLine();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get reflection of declaring class
|
||||
*
|
||||
@ -97,7 +97,7 @@ class Zend_Reflection_Method extends ReflectionMethod
|
||||
unset($phpReflection);
|
||||
return $zendReflection;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get all method parameter reflection objects
|
||||
*
|
||||
@ -120,7 +120,7 @@ class Zend_Reflection_Method extends ReflectionMethod
|
||||
unset($phpReflections);
|
||||
return $zendReflections;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get method contents
|
||||
*
|
||||
@ -132,10 +132,10 @@ class Zend_Reflection_Method extends ReflectionMethod
|
||||
$fileContents = file($this->getFileName());
|
||||
$startNum = $this->getStartLine($includeDocblock);
|
||||
$endNum = ($this->getEndLine() - $this->getStartLine());
|
||||
|
||||
|
||||
return implode("\n", array_splice($fileContents, $startNum, $endNum, true));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get method body
|
||||
*
|
||||
@ -144,25 +144,25 @@ class Zend_Reflection_Method extends ReflectionMethod
|
||||
public function getBody()
|
||||
{
|
||||
$lines = array_slice(
|
||||
file($this->getDeclaringClass()->getFileName()),
|
||||
$this->getStartLine(),
|
||||
($this->getEndLine() - $this->getStartLine()),
|
||||
file($this->getDeclaringClass()->getFileName(), FILE_IGNORE_NEW_LINES),
|
||||
$this->getStartLine(),
|
||||
($this->getEndLine() - $this->getStartLine()),
|
||||
true
|
||||
);
|
||||
|
||||
|
||||
$firstLine = array_shift($lines);
|
||||
|
||||
if (trim($firstLine) !== '{') {
|
||||
array_unshift($lines, $firstLine);
|
||||
}
|
||||
|
||||
|
||||
$lastLine = array_pop($lines);
|
||||
|
||||
|
||||
if (trim($lastLine) !== '}') {
|
||||
array_push($lines, $lastLine);
|
||||
}
|
||||
|
||||
// just in case we had code on the braket lines
|
||||
// just in case we had code on the bracket lines
|
||||
return rtrim(ltrim(implode("\n", $lines), '{'), '}');
|
||||
}
|
||||
}
|
||||
|
@ -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: Parameter.php 16971 2009-07-22 18:05:45Z mikaelkael $
|
||||
* @version $Id: Parameter.php 18951 2009-11-12 16:26:19Z alexander $
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -25,13 +25,13 @@
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Reflection_Parameter extends ReflectionParameter
|
||||
class Zend_Reflection_Parameter extends ReflectionParameter
|
||||
{
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
protected $_isFromMethod = false;
|
||||
|
||||
|
||||
/**
|
||||
* Get declaring class reflection object
|
||||
*
|
||||
@ -49,7 +49,7 @@ class Zend_Reflection_Parameter extends ReflectionParameter
|
||||
unset($phpReflection);
|
||||
return $zendReflection;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get class reflection object
|
||||
*
|
||||
@ -59,6 +59,10 @@ class Zend_Reflection_Parameter extends ReflectionParameter
|
||||
public function getClass($reflectionClass = 'Zend_Reflection_Class')
|
||||
{
|
||||
$phpReflection = parent::getClass();
|
||||
if($phpReflection == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$zendReflection = new $reflectionClass($phpReflection->getName());
|
||||
if (!$zendReflection instanceof Zend_Reflection_Class) {
|
||||
require_once 'Zend/Reflection/Exception.php';
|
||||
@ -67,7 +71,7 @@ class Zend_Reflection_Parameter extends ReflectionParameter
|
||||
unset($phpReflection);
|
||||
return $zendReflection;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get declaring function reflection object
|
||||
*
|
||||
@ -97,7 +101,7 @@ class Zend_Reflection_Parameter extends ReflectionParameter
|
||||
unset($phpReflection);
|
||||
return $zendReflection;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get parameter type
|
||||
*
|
||||
@ -107,13 +111,13 @@ class Zend_Reflection_Parameter extends ReflectionParameter
|
||||
{
|
||||
if ($docblock = $this->getDeclaringFunction()->getDocblock()) {
|
||||
$params = $docblock->getTags('param');
|
||||
|
||||
if (isset($params[$this->getPosition() - 1])) {
|
||||
return $params[$this->getPosition() - 1]->getType();
|
||||
|
||||
if (isset($params[$this->getPosition()])) {
|
||||
return $params[$this->getPosition()]->getType();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -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: Property.php 16971 2009-07-22 18:05:45Z mikaelkael $
|
||||
* @version $Id: Property.php 18951 2009-11-12 16:26:19Z alexander $
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -47,8 +47,8 @@ class Zend_Reflection_Property extends ReflectionProperty
|
||||
|
||||
/**
|
||||
* Get docblock comment
|
||||
*
|
||||
* @param string $reflectionClass
|
||||
*
|
||||
* @param string $reflectionClass
|
||||
* @return Zend_Reflection_Docblock|false False if no docblock defined
|
||||
*/
|
||||
public function getDocComment($reflectionClass = 'Zend_Reflection_Docblock')
|
||||
|
Reference in New Issue
Block a user