CC-2166: Packaging Improvements. Moved the Zend app into airtime_mvc. It is now installed to /var/www/airtime. Storage is now set to /srv/airtime/stor. Utils are now installed to /usr/lib/airtime/utils/. Added install/airtime-dircheck.php as a simple test to see if everything is install/uninstalled correctly.
This commit is contained in:
parent
514777e8d2
commit
b11cbd8159
4546 changed files with 138 additions and 51 deletions
247
airtime_mvc/library/Zend/Reflection/Class.php
Normal file
247
airtime_mvc/library/Zend/Reflection/Class.php
Normal file
|
@ -0,0 +1,247 @@
|
|||
<?php
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@zend.com so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Reflection
|
||||
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Class.php 20096 2010-01-06 02:05:09Z bkarwin $
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Reflection_Property
|
||||
*/
|
||||
require_once 'Zend/Reflection/Property.php';
|
||||
|
||||
/**
|
||||
* @see Zend_Reflection_Method
|
||||
*/
|
||||
require_once 'Zend/Reflection/Method.php';
|
||||
|
||||
/**
|
||||
* Zend_Reflection_Docblock
|
||||
*/
|
||||
require_once 'Zend/Reflection/Docblock.php';
|
||||
|
||||
/**
|
||||
* @category Zend
|
||||
* @package Zend_Reflection
|
||||
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Reflection_Class extends ReflectionClass
|
||||
{
|
||||
/**
|
||||
* Return the reflection file of the declaring file.
|
||||
*
|
||||
* @return Zend_Reflection_File
|
||||
*/
|
||||
public function getDeclaringFile($reflectionClass = 'Zend_Reflection_File')
|
||||
{
|
||||
$instance = new $reflectionClass($this->getFileName());
|
||||
if (!$instance instanceof Zend_Reflection_File) {
|
||||
require_once 'Zend/Reflection/Exception.php';
|
||||
throw new Zend_Reflection_Exception('Invalid reflection class specified; must extend Zend_Reflection_File');
|
||||
}
|
||||
return $instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the classes Docblock reflection object
|
||||
*
|
||||
* @param string $reflectionClass Name of reflection class to use
|
||||
* @return Zend_Reflection_Docblock
|
||||
* @throws Zend_Reflection_Exception for missing docblock or invalid reflection class
|
||||
*/
|
||||
public function getDocblock($reflectionClass = 'Zend_Reflection_Docblock')
|
||||
{
|
||||
if ('' == $this->getDocComment()) {
|
||||
require_once 'Zend/Reflection/Exception.php';
|
||||
throw new Zend_Reflection_Exception($this->getName() . ' does not have a docblock');
|
||||
}
|
||||
|
||||
$instance = new $reflectionClass($this);
|
||||
if (!$instance instanceof Zend_Reflection_Docblock) {
|
||||
require_once 'Zend/Reflection/Exception.php';
|
||||
throw new Zend_Reflection_Exception('Invalid reflection class specified; must extend Zend_Reflection_Docblock');
|
||||
}
|
||||
return $instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the start line of the class
|
||||
*
|
||||
* @param bool $includeDocComment
|
||||
* @return int
|
||||
*/
|
||||
public function getStartLine($includeDocComment = false)
|
||||
{
|
||||
if ($includeDocComment) {
|
||||
if ($this->getDocComment() != '') {
|
||||
return $this->getDocblock()->getStartLine();
|
||||
}
|
||||
}
|
||||
|
||||
return parent::getStartLine();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the contents of the class
|
||||
*
|
||||
* @param bool $includeDocblock
|
||||
* @return string
|
||||
*/
|
||||
public function getContents($includeDocblock = true)
|
||||
{
|
||||
$filename = $this->getFileName();
|
||||
$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
|
||||
*
|
||||
* @param string $reflectionClass Name of reflection class to use
|
||||
* @return array Array of Zend_Reflection_Class
|
||||
*/
|
||||
public function getInterfaces($reflectionClass = 'Zend_Reflection_Class')
|
||||
{
|
||||
$phpReflections = parent::getInterfaces();
|
||||
$zendReflections = array();
|
||||
while ($phpReflections && ($phpReflection = array_shift($phpReflections))) {
|
||||
$instance = new $reflectionClass($phpReflection->getName());
|
||||
if (!$instance instanceof Zend_Reflection_Class) {
|
||||
require_once 'Zend/Reflection/Exception.php';
|
||||
throw new Zend_Reflection_Exception('Invalid reflection class specified; must extend Zend_Reflection_Class');
|
||||
}
|
||||
$zendReflections[] = $instance;
|
||||
unset($phpReflection);
|
||||
}
|
||||
unset($phpReflections);
|
||||
return $zendReflections;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return method reflection by name
|
||||
*
|
||||
* @param string $name
|
||||
* @param string $reflectionClass Reflection class to utilize
|
||||
* @return Zend_Reflection_Method
|
||||
*/
|
||||
public function getMethod($name, $reflectionClass = 'Zend_Reflection_Method')
|
||||
{
|
||||
$phpReflection = parent::getMethod($name);
|
||||
$zendReflection = new $reflectionClass($this->getName(), $phpReflection->getName());
|
||||
|
||||
if (!$zendReflection instanceof Zend_Reflection_Method) {
|
||||
require_once 'Zend/Reflection/Exception.php';
|
||||
throw new Zend_Reflection_Exception('Invalid reflection class specified; must extend Zend_Reflection_Method');
|
||||
}
|
||||
|
||||
unset($phpReflection);
|
||||
return $zendReflection;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get reflection objects of all methods
|
||||
*
|
||||
* @param string $filter
|
||||
* @param string $reflectionClass Reflection class to use for methods
|
||||
* @return array Array of Zend_Reflection_Method objects
|
||||
*/
|
||||
public function getMethods($filter = -1, $reflectionClass = 'Zend_Reflection_Method')
|
||||
{
|
||||
$phpReflections = parent::getMethods($filter);
|
||||
$zendReflections = array();
|
||||
while ($phpReflections && ($phpReflection = array_shift($phpReflections))) {
|
||||
$instance = new $reflectionClass($this->getName(), $phpReflection->getName());
|
||||
if (!$instance instanceof Zend_Reflection_Method) {
|
||||
require_once 'Zend/Reflection/Exception.php';
|
||||
throw new Zend_Reflection_Exception('Invalid reflection class specified; must extend Zend_Reflection_Method');
|
||||
}
|
||||
$zendReflections[] = $instance;
|
||||
unset($phpReflection);
|
||||
}
|
||||
unset($phpReflections);
|
||||
return $zendReflections;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get parent reflection class of reflected class
|
||||
*
|
||||
* @param string $reflectionClass Name of Reflection class to use
|
||||
* @return Zend_Reflection_Class
|
||||
*/
|
||||
public function getParentClass($reflectionClass = 'Zend_Reflection_Class')
|
||||
{
|
||||
$phpReflection = parent::getParentClass();
|
||||
if ($phpReflection) {
|
||||
$zendReflection = new $reflectionClass($phpReflection->getName());
|
||||
if (!$zendReflection instanceof Zend_Reflection_Class) {
|
||||
require_once 'Zend/Reflection/Exception.php';
|
||||
throw new Zend_Reflection_Exception('Invalid reflection class specified; must extend Zend_Reflection_Class');
|
||||
}
|
||||
unset($phpReflection);
|
||||
return $zendReflection;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return reflection property of this class by name
|
||||
*
|
||||
* @param string $name
|
||||
* @param string $reflectionClass Name of reflection class to use
|
||||
* @return Zend_Reflection_Property
|
||||
*/
|
||||
public function getProperty($name, $reflectionClass = 'Zend_Reflection_Property')
|
||||
{
|
||||
$phpReflection = parent::getProperty($name);
|
||||
$zendReflection = new $reflectionClass($this->getName(), $phpReflection->getName());
|
||||
if (!$zendReflection instanceof Zend_Reflection_Property) {
|
||||
require_once 'Zend/Reflection/Exception.php';
|
||||
throw new Zend_Reflection_Exception('Invalid reflection class specified; must extend Zend_Reflection_Property');
|
||||
}
|
||||
unset($phpReflection);
|
||||
return $zendReflection;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return reflection properties of this class
|
||||
*
|
||||
* @param int $filter
|
||||
* @param string $reflectionClass Name of reflection class to use
|
||||
* @return array Array of Zend_Reflection_Property
|
||||
*/
|
||||
public function getProperties($filter = -1, $reflectionClass = 'Zend_Reflection_Property')
|
||||
{
|
||||
$phpReflections = parent::getProperties($filter);
|
||||
$zendReflections = array();
|
||||
while ($phpReflections && ($phpReflection = array_shift($phpReflections))) {
|
||||
$instance = new $reflectionClass($this->getName(), $phpReflection->getName());
|
||||
if (!$instance instanceof Zend_Reflection_Property) {
|
||||
require_once 'Zend/Reflection/Exception.php';
|
||||
throw new Zend_Reflection_Exception('Invalid reflection class specified; must extend Zend_Reflection_Property');
|
||||
}
|
||||
$zendReflections[] = $instance;
|
||||
unset($phpReflection);
|
||||
}
|
||||
unset($phpReflections);
|
||||
return $zendReflections;
|
||||
}
|
||||
}
|
294
airtime_mvc/library/Zend/Reflection/Docblock.php
Normal file
294
airtime_mvc/library/Zend/Reflection/Docblock.php
Normal file
|
@ -0,0 +1,294 @@
|
|||
<?php
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@zend.com so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Reflection
|
||||
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Docblock.php 20096 2010-01-06 02:05:09Z bkarwin $
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Reflection_Docblock_Tag
|
||||
*/
|
||||
require_once 'Zend/Reflection/Docblock/Tag.php';
|
||||
|
||||
/**
|
||||
* @category Zend
|
||||
* @package Zend_Reflection
|
||||
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
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
|
||||
*
|
||||
* Reqired by the Reflector interface.
|
||||
*
|
||||
* @todo What should this do?
|
||||
* @return void
|
||||
*/
|
||||
public static function export()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Serialize to string
|
||||
*
|
||||
* Required by the Reflector interface
|
||||
*
|
||||
* @todo What should this return?
|
||||
* @return string
|
||||
*/
|
||||
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
|
||||
*
|
||||
* @param Reflector|string $commentOrReflector
|
||||
*/
|
||||
public function __construct($commentOrReflector)
|
||||
{
|
||||
if ($commentOrReflector instanceof Reflector) {
|
||||
$this->_reflector = $commentOrReflector;
|
||||
if (!method_exists($commentOrReflector, 'getDocComment')) {
|
||||
require_once 'Zend/Reflection/Exception.php';
|
||||
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
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getContents()
|
||||
{
|
||||
return $this->_cleanDocComment;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get start line (position) of docblock
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getStartLine()
|
||||
{
|
||||
return $this->_startLine;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get last line (position) of docblock
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getEndLine()
|
||||
{
|
||||
return $this->_endLine;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get docblock short description
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getShortDescription()
|
||||
{
|
||||
return $this->_shortDescription;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get docblock long description
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getLongDescription()
|
||||
{
|
||||
return $this->_longDescription;
|
||||
}
|
||||
|
||||
/**
|
||||
* Does the docblock contain the given annotation tag?
|
||||
*
|
||||
* @param string $name
|
||||
* @return bool
|
||||
*/
|
||||
public function hasTag($name)
|
||||
{
|
||||
foreach ($this->_tags as $tag) {
|
||||
if ($tag->getName() == $name) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the given docblock tag
|
||||
*
|
||||
* @param string $name
|
||||
* @return Zend_Reflection_Docblock_Tag|false
|
||||
*/
|
||||
public function getTag($name)
|
||||
{
|
||||
foreach ($this->_tags as $tag) {
|
||||
if ($tag->getName() == $name) {
|
||||
return $tag;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all docblock annotation tags
|
||||
*
|
||||
* @param string $filter
|
||||
* @return array Array of Zend_Reflection_Docblock_Tag
|
||||
*/
|
||||
public function getTags($filter = null)
|
||||
{
|
||||
if ($filter === null || !is_string($filter)) {
|
||||
return $this->_tags;
|
||||
}
|
||||
|
||||
$returnTags = array();
|
||||
foreach ($this->_tags as $tag) {
|
||||
if ($tag->getName() == $filter) {
|
||||
$returnTags[] = $tag;
|
||||
}
|
||||
}
|
||||
return $returnTags;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse the docblock
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
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);
|
||||
} else {
|
||||
if ($lineNumber < 3 && !$firstBlandLineEncountered) {
|
||||
$this->_shortDescription .= $line . "\n";
|
||||
} else {
|
||||
$this->_longDescription .= $line . "\n";
|
||||
}
|
||||
|
||||
if ($line == '') {
|
||||
$firstBlandLineEncountered = true;
|
||||
}
|
||||
|
||||
$parsedDocComment = substr($parsedDocComment, $newlinePos + 1);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$this->_shortDescription = rtrim($this->_shortDescription);
|
||||
$this->_longDescription = rtrim($this->_longDescription);
|
||||
}
|
||||
}
|
145
airtime_mvc/library/Zend/Reflection/Docblock/Tag.php
Normal file
145
airtime_mvc/library/Zend/Reflection/Docblock/Tag.php
Normal file
|
@ -0,0 +1,145 @@
|
|||
<?php
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@zend.com so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Reflection
|
||||
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Tag.php 20096 2010-01-06 02:05:09Z bkarwin $
|
||||
*/
|
||||
|
||||
/** Zend_Loader */
|
||||
require_once 'Zend/Loader.php';
|
||||
|
||||
/**
|
||||
* @category Zend
|
||||
* @package Zend_Reflection
|
||||
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Reflection_Docblock_Tag implements Reflector
|
||||
{
|
||||
/**
|
||||
* @var array Array of Class names
|
||||
*/
|
||||
protected static $_tagClasses = array(
|
||||
'param' => 'Zend_Reflection_Docblock_Tag_Param',
|
||||
'return' => 'Zend_Reflection_Docblock_Tag_Return',
|
||||
);
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $_name = null;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $_description = null;
|
||||
|
||||
/**
|
||||
* Factory: Create the appropriate annotation tag object
|
||||
*
|
||||
* @param string $tagDocblockLine
|
||||
* @return Zend_Reflection_Docblock_Tag
|
||||
*/
|
||||
public static function factory($tagDocblockLine)
|
||||
{
|
||||
$matches = array();
|
||||
|
||||
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.');
|
||||
}
|
||||
|
||||
$tagName = $matches[1];
|
||||
if (array_key_exists($tagName, self::$_tagClasses)) {
|
||||
$tagClass = self::$_tagClasses[$tagName];
|
||||
if (!class_exists($tagClass)) {
|
||||
Zend_Loader::loadClass($tagClass);
|
||||
}
|
||||
return new $tagClass($tagDocblockLine);
|
||||
}
|
||||
return new self($tagDocblockLine);
|
||||
}
|
||||
|
||||
/**
|
||||
* Export reflection
|
||||
*
|
||||
* Required by Reflector
|
||||
*
|
||||
* @todo What should this do?
|
||||
* @return void
|
||||
*/
|
||||
public static function export()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Serialize to string
|
||||
*
|
||||
* Required by Reflector
|
||||
*
|
||||
* @todo What should this do?
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
$str = "Docblock Tag [ * @".$this->_name." ]".PHP_EOL;
|
||||
|
||||
return $str;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param string $tagDocblockLine
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($tagDocblockLine)
|
||||
{
|
||||
$matches = array();
|
||||
|
||||
// find the line
|
||||
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 (isset($matches[2]) && $matches[2]) {
|
||||
$this->_description = $matches[2];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get annotation tag name
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return $this->_name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get annotation tag description
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getDescription()
|
||||
{
|
||||
return $this->_description;
|
||||
}
|
||||
}
|
93
airtime_mvc/library/Zend/Reflection/Docblock/Tag/Param.php
Normal file
93
airtime_mvc/library/Zend/Reflection/Docblock/Tag/Param.php
Normal file
|
@ -0,0 +1,93 @@
|
|||
<?php
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@zend.com so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Reflection
|
||||
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Param.php 20096 2010-01-06 02:05:09Z bkarwin $
|
||||
*/
|
||||
|
||||
/** Zend_Reflection_Docblock_Tag */
|
||||
require_once 'Zend/Reflection/Docblock/Tag.php';
|
||||
|
||||
/**
|
||||
* @category Zend
|
||||
* @package Zend_Reflection
|
||||
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Reflection_Docblock_Tag_Param extends Zend_Reflection_Docblock_Tag
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $_type = null;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $_variableName = null;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param string $tagDocblockLine
|
||||
*/
|
||||
public function __construct($tagDocblockLine)
|
||||
{
|
||||
$matches = array();
|
||||
|
||||
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
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getType()
|
||||
{
|
||||
return $this->_type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get parameter name
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getVariableName()
|
||||
{
|
||||
return $this->_variableName;
|
||||
}
|
||||
}
|
72
airtime_mvc/library/Zend/Reflection/Docblock/Tag/Return.php
Normal file
72
airtime_mvc/library/Zend/Reflection/Docblock/Tag/Return.php
Normal file
|
@ -0,0 +1,72 @@
|
|||
<?php
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@zend.com so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Reflection
|
||||
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Return.php 20096 2010-01-06 02:05:09Z bkarwin $
|
||||
*/
|
||||
|
||||
/** Zend_Reflection_Docblock_Tag */
|
||||
require_once 'Zend/Reflection/Docblock/Tag.php';
|
||||
|
||||
/**
|
||||
* @category Zend
|
||||
* @package Zend_Reflection
|
||||
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Reflection_Docblock_Tag_Return extends Zend_Reflection_Docblock_Tag
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $_type = null;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param string $tagDocblockLine
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($tagDocblockLine)
|
||||
{
|
||||
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
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getType()
|
||||
{
|
||||
return $this->_type;
|
||||
}
|
||||
}
|
36
airtime_mvc/library/Zend/Reflection/Exception.php
Normal file
36
airtime_mvc/library/Zend/Reflection/Exception.php
Normal file
|
@ -0,0 +1,36 @@
|
|||
<?php
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@zend.com so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Reflection
|
||||
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Exception
|
||||
*/
|
||||
require_once 'Zend/Exception.php';
|
||||
|
||||
/**
|
||||
* @category Zend
|
||||
* @package Zend_Reflection
|
||||
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Reflection_Exception extends Zend_Exception
|
||||
{
|
||||
|
||||
}
|
85
airtime_mvc/library/Zend/Reflection/Extension.php
Normal file
85
airtime_mvc/library/Zend/Reflection/Extension.php
Normal file
|
@ -0,0 +1,85 @@
|
|||
<?php
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@zend.com so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Reflection
|
||||
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Extension.php 20096 2010-01-06 02:05:09Z bkarwin $
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Reflection_Class
|
||||
*/
|
||||
require_once 'Zend/Reflection/Class.php';
|
||||
|
||||
/**
|
||||
* @see Zend_Reflection_Function
|
||||
*/
|
||||
require_once 'Zend/Reflection/Function.php';
|
||||
|
||||
/**
|
||||
* @category Zend
|
||||
* @package Zend_Reflection
|
||||
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Reflection_Extension extends ReflectionExtension
|
||||
{
|
||||
/**
|
||||
* Get extension function reflection objects
|
||||
*
|
||||
* @param string $reflectionClass Name of reflection class to use
|
||||
* @return array Array of Zend_Reflection_Function objects
|
||||
*/
|
||||
public function getFunctions($reflectionClass = 'Zend_Reflection_Function')
|
||||
{
|
||||
$phpReflections = parent::getFunctions();
|
||||
$zendReflections = array();
|
||||
while ($phpReflections && ($phpReflection = array_shift($phpReflections))) {
|
||||
$instance = new $reflectionClass($phpReflection->getName());
|
||||
if (!$instance instanceof Zend_Reflection_Function) {
|
||||
require_once 'Zend/Reflection/Exception.php';
|
||||
throw new Zend_Reflection_Exception('Invalid reflection class provided; must extend Zend_Reflection_Function');
|
||||
}
|
||||
$zendReflections[] = $instance;
|
||||
unset($phpReflection);
|
||||
}
|
||||
unset($phpReflections);
|
||||
return $zendReflections;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get extension class reflection objects
|
||||
*
|
||||
* @param string $reflectionClass Name of reflection class to use
|
||||
* @return array Array of Zend_Reflection_Class objects
|
||||
*/
|
||||
public function getClasses($reflectionClass = 'Zend_Reflection_Class')
|
||||
{
|
||||
$phpReflections = parent::getClasses();
|
||||
$zendReflections = array();
|
||||
while ($phpReflections && ($phpReflection = array_shift($phpReflections))) {
|
||||
$instance = new $reflectionClass($phpReflection->getName());
|
||||
if (!$instance instanceof Zend_Reflection_Class) {
|
||||
require_once 'Zend/Reflection/Exception.php';
|
||||
throw new Zend_Reflection_Exception('Invalid reflection class provided; must extend Zend_Reflection_Class');
|
||||
}
|
||||
$zendReflections[] = $instance;
|
||||
unset($phpReflection);
|
||||
}
|
||||
unset($phpReflections);
|
||||
return $zendReflections;
|
||||
}
|
||||
}
|
412
airtime_mvc/library/Zend/Reflection/File.php
Normal file
412
airtime_mvc/library/Zend/Reflection/File.php
Normal file
|
@ -0,0 +1,412 @@
|
|||
<?php
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@zend.com so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Reflection
|
||||
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: File.php 20903 2010-02-04 16:16:47Z matthew $
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Reflection_Class
|
||||
*/
|
||||
require_once 'Zend/Reflection/Class.php';
|
||||
|
||||
/**
|
||||
* @see Zend_Reflection_Function
|
||||
*/
|
||||
require_once 'Zend/Reflection/Function.php';
|
||||
|
||||
/**
|
||||
* @category Zend
|
||||
* @package Zend_Reflection
|
||||
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
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
|
||||
*/
|
||||
protected $_contents = null;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param string $file
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($file)
|
||||
{
|
||||
$fileName = $file;
|
||||
|
||||
if (($fileRealpath = realpath($fileName)) === false) {
|
||||
$fileRealpath = self::findRealpathInIncludePath($file);
|
||||
}
|
||||
|
||||
if (!$fileRealpath || !in_array($fileRealpath, get_included_files())) {
|
||||
require_once 'Zend/Reflection/Exception.php';
|
||||
throw new Zend_Reflection_Exception('File ' . $file . ' must be required before it can be reflected');
|
||||
}
|
||||
|
||||
$this->_fileName = $fileRealpath;
|
||||
$this->_contents = file_get_contents($this->_fileName);
|
||||
$this->_reflect();
|
||||
}
|
||||
|
||||
/**
|
||||
* Find realpath of file based on include_path
|
||||
*
|
||||
* @param string $fileName
|
||||
* @return string
|
||||
*/
|
||||
public static function findRealpathInIncludePath($fileName)
|
||||
{
|
||||
require_once 'Zend/Loader.php';
|
||||
$includePaths = Zend_Loader::explodeIncludePath();
|
||||
while (count($includePaths) > 0) {
|
||||
$filePath = array_shift($includePaths) . DIRECTORY_SEPARATOR . $fileName;
|
||||
|
||||
if ( ($foundRealpath = realpath($filePath)) !== false) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return $foundRealpath;
|
||||
}
|
||||
|
||||
/**
|
||||
* Export
|
||||
*
|
||||
* Required by the Reflector interface.
|
||||
*
|
||||
* @todo What should this do?
|
||||
* @return null
|
||||
*/
|
||||
public static function export()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the file name of the reflected file
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getFileName()
|
||||
{
|
||||
return $this->_fileName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the start line - Always 1, staying consistent with the Reflection API
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getStartLine()
|
||||
{
|
||||
return $this->_startLine;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the end line / number of lines
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getEndLine()
|
||||
{
|
||||
return $this->_endLine;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the doc comment
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getDocComment()
|
||||
{
|
||||
return $this->_docComment;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the docblock
|
||||
*
|
||||
* @param string $reflectionClass Reflection class to use
|
||||
* @return Zend_Reflection_Docblock
|
||||
*/
|
||||
public function getDocblock($reflectionClass = 'Zend_Reflection_Docblock')
|
||||
{
|
||||
$instance = new $reflectionClass($this);
|
||||
if (!$instance instanceof Zend_Reflection_Docblock) {
|
||||
require_once 'Zend/Reflection/Exception.php';
|
||||
throw new Zend_Reflection_Exception('Invalid reflection class specified; must extend Zend_Reflection_Docblock');
|
||||
}
|
||||
return $instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the reflection classes of the classes found inside this file
|
||||
*
|
||||
* @param string $reflectionClass Name of reflection class to use for instances
|
||||
* @return array Array of Zend_Reflection_Class instances
|
||||
*/
|
||||
public function getClasses($reflectionClass = 'Zend_Reflection_Class')
|
||||
{
|
||||
$classes = array();
|
||||
foreach ($this->_classes as $class) {
|
||||
$instance = new $reflectionClass($class);
|
||||
if (!$instance instanceof Zend_Reflection_Class) {
|
||||
require_once 'Zend/Reflection/Exception.php';
|
||||
throw new Zend_Reflection_Exception('Invalid reflection class provided; must extend Zend_Reflection_Class');
|
||||
}
|
||||
$classes[] = $instance;
|
||||
}
|
||||
return $classes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the reflection functions of the functions found inside this file
|
||||
*
|
||||
* @param string $reflectionClass Name of reflection class to use for instances
|
||||
* @return array Array of Zend_Reflection_Functions
|
||||
*/
|
||||
public function getFunctions($reflectionClass = 'Zend_Reflection_Function')
|
||||
{
|
||||
$functions = array();
|
||||
foreach ($this->_functions as $function) {
|
||||
$instance = new $reflectionClass($function);
|
||||
if (!$instance instanceof Zend_Reflection_Function) {
|
||||
require_once 'Zend/Reflection/Exception.php';
|
||||
throw new Zend_Reflection_Exception('Invalid reflection class provided; must extend Zend_Reflection_Function');
|
||||
}
|
||||
$functions[] = $instance;
|
||||
}
|
||||
return $functions;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the reflection class of a given class found in this file
|
||||
*
|
||||
* @param null|string $name
|
||||
* @param string $reflectionClass Reflection class to use when creating reflection instance
|
||||
* @return Zend_Reflection_Class
|
||||
* @throws Zend_Reflection_Exception for invalid class name or invalid reflection class
|
||||
*/
|
||||
public function getClass($name = null, $reflectionClass = 'Zend_Reflection_Class')
|
||||
{
|
||||
if ($name === null) {
|
||||
reset($this->_classes);
|
||||
$selected = current($this->_classes);
|
||||
$instance = new $reflectionClass($selected);
|
||||
if (!$instance instanceof Zend_Reflection_Class) {
|
||||
require_once 'Zend/Reflection/Exception.php';
|
||||
throw new Zend_Reflection_Exception('Invalid reflection class given; must extend Zend_Reflection_Class');
|
||||
}
|
||||
return $instance;
|
||||
}
|
||||
|
||||
if (in_array($name, $this->_classes)) {
|
||||
$instance = new $reflectionClass($name);
|
||||
if (!$instance instanceof Zend_Reflection_Class) {
|
||||
require_once 'Zend/Reflection/Exception.php';
|
||||
throw new Zend_Reflection_Exception('Invalid reflection class given; must extend Zend_Reflection_Class');
|
||||
}
|
||||
return $instance;
|
||||
}
|
||||
|
||||
require_once 'Zend/Reflection/Exception.php';
|
||||
throw new Zend_Reflection_Exception('Class by name ' . $name . ' not found.');
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the full contents of file
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getContents()
|
||||
{
|
||||
return $this->_contents;
|
||||
}
|
||||
|
||||
/**
|
||||
* Serialize to string
|
||||
*
|
||||
* Required by the Reflector interface
|
||||
*
|
||||
* @todo What should this serialization look like?
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* This method does the work of "reflecting" the file
|
||||
*
|
||||
* Uses PHP's tokenizer to perform file reflection.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function _reflect()
|
||||
{
|
||||
$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
|
||||
*
|
||||
* - 0 => token id,
|
||||
* - 1 => string,
|
||||
* - 2 => line number
|
||||
*
|
||||
* Token ID's are explained here:
|
||||
* http://www.php.net/manual/en/tokens.php.
|
||||
*/
|
||||
|
||||
if (is_array($token)) {
|
||||
$type = $token[0];
|
||||
$value = $token[1];
|
||||
$lineNum = $token[2];
|
||||
} else {
|
||||
// It's a symbol
|
||||
// Maintain the count of open braces
|
||||
if ($token == '{') {
|
||||
$openBraces++;
|
||||
} else if ($token == '}') {
|
||||
$openBraces--;
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
switch ($type) {
|
||||
// Name of something
|
||||
case T_STRING:
|
||||
if ($functionTrapped) {
|
||||
$this->_functions[] = $value;
|
||||
$functionTrapped = false;
|
||||
} elseif ($classTrapped) {
|
||||
$this->_classes[] = $value;
|
||||
$classTrapped = false;
|
||||
}
|
||||
continue;
|
||||
|
||||
// Required file names are T_CONSTANT_ENCAPSED_STRING
|
||||
case T_CONSTANT_ENCAPSED_STRING:
|
||||
if ($requireTrapped) {
|
||||
$this->_requiredFiles[] = $value ."\n";
|
||||
$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:
|
||||
case T_INCLUDE:
|
||||
case T_INCLUDE_ONCE:
|
||||
$requireTrapped = true;
|
||||
break;
|
||||
|
||||
// Default case: do nothing
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$this->_endLine = count(explode("\n", $this->_contents));
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate / check a file level docblock
|
||||
*
|
||||
* @param array $tokens Array of tokenizer tokens
|
||||
* @return void
|
||||
*/
|
||||
protected function _checkFileDocBlock($tokens) {
|
||||
foreach ($tokens as $token) {
|
||||
$type = $token[0];
|
||||
$value = $token[1];
|
||||
$lineNum = $token[2];
|
||||
if(($type == T_OPEN_TAG) || ($type == T_WHITESPACE)) {
|
||||
continue;
|
||||
} elseif ($type == T_DOC_COMMENT) {
|
||||
$this->_docComment = $value;
|
||||
$this->_startLine = $lineNum + substr_count($value, "\n") + 1;
|
||||
return;
|
||||
} else {
|
||||
// Only whitespace is allowed before file docblocks
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
129
airtime_mvc/library/Zend/Reflection/Function.php
Normal file
129
airtime_mvc/library/Zend/Reflection/Function.php
Normal file
|
@ -0,0 +1,129 @@
|
|||
<?php
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@zend.com so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Reflection
|
||||
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Function.php 20096 2010-01-06 02:05:09Z bkarwin $
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Reflection_Parameter
|
||||
*/
|
||||
require_once 'Zend/Reflection/Parameter.php';
|
||||
|
||||
/**
|
||||
* @category Zend
|
||||
* @package Zend_Reflection
|
||||
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Reflection_Function extends ReflectionFunction
|
||||
{
|
||||
/**
|
||||
* Get function docblock
|
||||
*
|
||||
* @param string $reflectionClass Name of reflection class to use
|
||||
* @return Zend_Reflection_Docblock
|
||||
*/
|
||||
public function getDocblock($reflectionClass = 'Zend_Reflection_Docblock')
|
||||
{
|
||||
if ('' == ($comment = $this->getDocComment())) {
|
||||
require_once 'Zend/Reflection/Exception.php';
|
||||
throw new Zend_Reflection_Exception($this->getName() . ' does not have a docblock');
|
||||
}
|
||||
$instance = new $reflectionClass($comment);
|
||||
if (!$instance instanceof Zend_Reflection_Docblock) {
|
||||
require_once 'Zend/Reflection/Exception.php';
|
||||
throw new Zend_Reflection_Exception('Invalid reflection class provided; must extend Zend_Reflection_Docblock');
|
||||
}
|
||||
return $instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get start line (position) of function
|
||||
*
|
||||
* @param bool $includeDocComment
|
||||
* @return int
|
||||
*/
|
||||
public function getStartLine($includeDocComment = false)
|
||||
{
|
||||
if ($includeDocComment) {
|
||||
if ($this->getDocComment() != '') {
|
||||
return $this->getDocblock()->getStartLine();
|
||||
}
|
||||
}
|
||||
|
||||
return parent::getStartLine();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get contents of function
|
||||
*
|
||||
* @param bool $includeDocblock
|
||||
* @return string
|
||||
*/
|
||||
public function getContents($includeDocblock = true)
|
||||
{
|
||||
return implode("\n",
|
||||
array_splice(
|
||||
file($this->getFileName()),
|
||||
$this->getStartLine($includeDocblock),
|
||||
($this->getEndLine() - $this->getStartLine()),
|
||||
true
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get function parameters
|
||||
*
|
||||
* @param string $reflectionClass Name of reflection class to use
|
||||
* @return array Array of Zend_Reflection_Parameter
|
||||
*/
|
||||
public function getParameters($reflectionClass = 'Zend_Reflection_Parameter')
|
||||
{
|
||||
$phpReflections = parent::getParameters();
|
||||
$zendReflections = array();
|
||||
while ($phpReflections && ($phpReflection = array_shift($phpReflections))) {
|
||||
$instance = new $reflectionClass($this->getName(), $phpReflection->getName());
|
||||
if (!$instance instanceof Zend_Reflection_Parameter) {
|
||||
require_once 'Zend/Reflection/Exception.php';
|
||||
throw new Zend_Reflection_Exception('Invalid reflection class provided; must extend Zend_Reflection_Parameter');
|
||||
}
|
||||
$zendReflections[] = $instance;
|
||||
unset($phpReflection);
|
||||
}
|
||||
unset($phpReflections);
|
||||
return $zendReflections;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get return type tag
|
||||
*
|
||||
* @return Zend_Reflection_Docblock_Tag_Return
|
||||
*/
|
||||
public function getReturn()
|
||||
{
|
||||
$docblock = $this->getDocblock();
|
||||
if (!$docblock->hasTag('return')) {
|
||||
require_once 'Zend/Reflection/Exception.php';
|
||||
throw new Zend_Reflection_Exception('Function does not specify an @return annotation tag; cannot determine return type');
|
||||
}
|
||||
$tag = $docblock->getTag('return');
|
||||
$return = Zend_Reflection_Docblock_Tag::factory('@return ' . $tag->getDescription());
|
||||
return $return;
|
||||
}
|
||||
}
|
168
airtime_mvc/library/Zend/Reflection/Method.php
Normal file
168
airtime_mvc/library/Zend/Reflection/Method.php
Normal file
|
@ -0,0 +1,168 @@
|
|||
<?php
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@zend.com so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Reflection
|
||||
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Method.php 20096 2010-01-06 02:05:09Z bkarwin $
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Reflection_Class
|
||||
*/
|
||||
require_once 'Zend/Reflection/Class.php';
|
||||
|
||||
/**
|
||||
* @see Zend_Reflection_Docblock
|
||||
*/
|
||||
require_once 'Zend/Reflection/Docblock.php';
|
||||
|
||||
/**
|
||||
* @see Zend_Reflection_Parameter
|
||||
*/
|
||||
require_once 'Zend/Reflection/Parameter.php';
|
||||
|
||||
/**
|
||||
* @category Zend
|
||||
* @package Zend_Reflection
|
||||
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Reflection_Method extends ReflectionMethod
|
||||
{
|
||||
/**
|
||||
* Retrieve method docblock reflection
|
||||
*
|
||||
* @return Zend_Reflection_Docblock
|
||||
* @throws Zend_Reflection_Exception
|
||||
*/
|
||||
public function getDocblock($reflectionClass = 'Zend_Reflection_Docblock')
|
||||
{
|
||||
if ('' == $this->getDocComment()) {
|
||||
require_once 'Zend/Reflection/Exception.php';
|
||||
throw new Zend_Reflection_Exception($this->getName() . ' does not have a docblock');
|
||||
}
|
||||
|
||||
$instance = new $reflectionClass($this);
|
||||
if (!$instance instanceof Zend_Reflection_Docblock) {
|
||||
require_once 'Zend/Reflection/Exception.php';
|
||||
throw new Zend_Reflection_Exception('Invalid reflection class provided; must extend Zend_Reflection_Docblock');
|
||||
}
|
||||
return $instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get start line (position) of method
|
||||
*
|
||||
* @param bool $includeDocComment
|
||||
* @return int
|
||||
*/
|
||||
public function getStartLine($includeDocComment = false)
|
||||
{
|
||||
if ($includeDocComment) {
|
||||
if ($this->getDocComment() != '') {
|
||||
return $this->getDocblock()->getStartLine();
|
||||
}
|
||||
}
|
||||
|
||||
return parent::getStartLine();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get reflection of declaring class
|
||||
*
|
||||
* @param string $reflectionClass Name of reflection class to use
|
||||
* @return Zend_Reflection_Class
|
||||
*/
|
||||
public function getDeclaringClass($reflectionClass = 'Zend_Reflection_Class')
|
||||
{
|
||||
$phpReflection = parent::getDeclaringClass();
|
||||
$zendReflection = new $reflectionClass($phpReflection->getName());
|
||||
if (!$zendReflection instanceof Zend_Reflection_Class) {
|
||||
require_once 'Zend/Reflection/Exception.php';
|
||||
throw new Zend_Reflection_Exception('Invalid reflection class provided; must extend Zend_Reflection_Class');
|
||||
}
|
||||
unset($phpReflection);
|
||||
return $zendReflection;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all method parameter reflection objects
|
||||
*
|
||||
* @param string $reflectionClass Name of reflection class to use
|
||||
* @return array of Zend_Reflection_Parameter objects
|
||||
*/
|
||||
public function getParameters($reflectionClass = 'Zend_Reflection_Parameter')
|
||||
{
|
||||
$phpReflections = parent::getParameters();
|
||||
$zendReflections = array();
|
||||
while ($phpReflections && ($phpReflection = array_shift($phpReflections))) {
|
||||
$instance = new $reflectionClass(array($this->getDeclaringClass()->getName(), $this->getName()), $phpReflection->getName());
|
||||
if (!$instance instanceof Zend_Reflection_Parameter) {
|
||||
require_once 'Zend/Reflection/Exception.php';
|
||||
throw new Zend_Reflection_Exception('Invalid reflection class provided; must extend Zend_Reflection_Parameter');
|
||||
}
|
||||
$zendReflections[] = $instance;
|
||||
unset($phpReflection);
|
||||
}
|
||||
unset($phpReflections);
|
||||
return $zendReflections;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get method contents
|
||||
*
|
||||
* @param bool $includeDocblock
|
||||
* @return string
|
||||
*/
|
||||
public function getContents($includeDocblock = true)
|
||||
{
|
||||
$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
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getBody()
|
||||
{
|
||||
$lines = array_slice(
|
||||
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 bracket lines
|
||||
return rtrim(ltrim(implode("\n", $lines), '{'), '}');
|
||||
}
|
||||
}
|
123
airtime_mvc/library/Zend/Reflection/Parameter.php
Normal file
123
airtime_mvc/library/Zend/Reflection/Parameter.php
Normal file
|
@ -0,0 +1,123 @@
|
|||
<?php
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@zend.com so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Reflection
|
||||
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Parameter.php 20096 2010-01-06 02:05:09Z bkarwin $
|
||||
*/
|
||||
|
||||
/**
|
||||
* @category Zend
|
||||
* @package Zend_Reflection
|
||||
* @copyright Copyright (c) 2005-2010 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
|
||||
{
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
protected $_isFromMethod = false;
|
||||
|
||||
/**
|
||||
* Get declaring class reflection object
|
||||
*
|
||||
* @param string $reflectionClass Reflection class to use
|
||||
* @return Zend_Reflection_Class
|
||||
*/
|
||||
public function getDeclaringClass($reflectionClass = 'Zend_Reflection_Class')
|
||||
{
|
||||
$phpReflection = parent::getDeclaringClass();
|
||||
$zendReflection = new $reflectionClass($phpReflection->getName());
|
||||
if (!$zendReflection instanceof Zend_Reflection_Class) {
|
||||
require_once 'Zend/Reflection/Exception.php';
|
||||
throw new Zend_Reflection_Exception('Invalid reflection class provided; must extend Zend_Reflection_Class');
|
||||
}
|
||||
unset($phpReflection);
|
||||
return $zendReflection;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get class reflection object
|
||||
*
|
||||
* @param string $reflectionClass Reflection class to use
|
||||
* @return Zend_Reflection_Class
|
||||
*/
|
||||
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';
|
||||
throw new Zend_Reflection_Exception('Invalid reflection class provided; must extend Zend_Reflection_Class');
|
||||
}
|
||||
unset($phpReflection);
|
||||
return $zendReflection;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get declaring function reflection object
|
||||
*
|
||||
* @param string $reflectionClass Reflection class to use
|
||||
* @return Zend_Reflection_Function|Zend_Reflection_Method
|
||||
*/
|
||||
public function getDeclaringFunction($reflectionClass = null)
|
||||
{
|
||||
$phpReflection = parent::getDeclaringFunction();
|
||||
if ($phpReflection instanceof ReflectionMethod) {
|
||||
$baseClass = 'Zend_Reflection_Method';
|
||||
if (null === $reflectionClass) {
|
||||
$reflectionClass = $baseClass;
|
||||
}
|
||||
$zendReflection = new $reflectionClass($this->getDeclaringClass()->getName(), $phpReflection->getName());
|
||||
} else {
|
||||
$baseClass = 'Zend_Reflection_Function';
|
||||
if (null === $reflectionClass) {
|
||||
$reflectionClass = $baseClass;
|
||||
}
|
||||
$zendReflection = new $reflectionClass($phpReflection->getName());
|
||||
}
|
||||
if (!$zendReflection instanceof $baseClass) {
|
||||
require_once 'Zend/Reflection/Exception.php';
|
||||
throw new Zend_Reflection_Exception('Invalid reflection class provided; must extend ' . $baseClass);
|
||||
}
|
||||
unset($phpReflection);
|
||||
return $zendReflection;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get parameter type
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getType()
|
||||
{
|
||||
if ($docblock = $this->getDeclaringFunction()->getDocblock()) {
|
||||
$params = $docblock->getTags('param');
|
||||
|
||||
if (isset($params[$this->getPosition()])) {
|
||||
return $params[$this->getPosition()]->getType();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
68
airtime_mvc/library/Zend/Reflection/Property.php
Normal file
68
airtime_mvc/library/Zend/Reflection/Property.php
Normal file
|
@ -0,0 +1,68 @@
|
|||
<?php
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@zend.com so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Reflection
|
||||
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Property.php 20096 2010-01-06 02:05:09Z bkarwin $
|
||||
*/
|
||||
|
||||
/**
|
||||
* @todo implement line numbers
|
||||
* @category Zend
|
||||
* @package Zend_Reflection
|
||||
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Reflection_Property extends ReflectionProperty
|
||||
{
|
||||
/**
|
||||
* Get declaring class reflection object
|
||||
*
|
||||
* @return Zend_Reflection_Class
|
||||
*/
|
||||
public function getDeclaringClass($reflectionClass = 'Zend_Reflection_Class')
|
||||
{
|
||||
$phpReflection = parent::getDeclaringClass();
|
||||
$zendReflection = new $reflectionClass($phpReflection->getName());
|
||||
if (!$zendReflection instanceof Zend_Reflection_Class) {
|
||||
require_once 'Zend/Reflection/Exception.php';
|
||||
throw new Zend_Reflection_Exception('Invalid reflection class provided; must extend Zend_Reflection_Class');
|
||||
}
|
||||
unset($phpReflection);
|
||||
return $zendReflection;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get docblock comment
|
||||
*
|
||||
* @param string $reflectionClass
|
||||
* @return Zend_Reflection_Docblock|false False if no docblock defined
|
||||
*/
|
||||
public function getDocComment($reflectionClass = 'Zend_Reflection_Docblock')
|
||||
{
|
||||
$docblock = parent::getDocComment();
|
||||
if (!$docblock) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$r = new $reflectionClass($docblock);
|
||||
if (!$r instanceof Zend_Reflection_Docblock) {
|
||||
require_once 'Zend/Reflection/Exception.php';
|
||||
throw new Zend_Reflection_Exception('Invalid reflection class provided; must extend Zend_Reflection_Docblock');
|
||||
}
|
||||
return $r;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue