diff options
Diffstat (limited to '')
-rw-r--r-- | library/vendor/Zend/Server/Reflection.php | 105 | ||||
-rw-r--r-- | library/vendor/Zend/Server/Reflection/Class.php | 195 | ||||
-rw-r--r-- | library/vendor/Zend/Server/Reflection/Exception.php | 37 | ||||
-rw-r--r-- | library/vendor/Zend/Server/Reflection/Function.php | 38 | ||||
-rw-r--r-- | library/vendor/Zend/Server/Reflection/Function/Abstract.php | 506 | ||||
-rw-r--r-- | library/vendor/Zend/Server/Reflection/Method.php | 109 | ||||
-rw-r--r-- | library/vendor/Zend/Server/Reflection/Node.php | 201 | ||||
-rw-r--r-- | library/vendor/Zend/Server/Reflection/Parameter.php | 158 | ||||
-rw-r--r-- | library/vendor/Zend/Server/Reflection/Prototype.php | 99 | ||||
-rw-r--r-- | library/vendor/Zend/Server/Reflection/ReturnValue.php | 108 |
10 files changed, 1556 insertions, 0 deletions
diff --git a/library/vendor/Zend/Server/Reflection.php b/library/vendor/Zend/Server/Reflection.php new file mode 100644 index 0000000..5d95c64 --- /dev/null +++ b/library/vendor/Zend/Server/Reflection.php @@ -0,0 +1,105 @@ +<?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_Server + * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ + +/** + * Zend_Server_Reflection_Function + */ + +/** + * Zend_Server_Reflection_Class + */ + +/** + * Reflection for determining method signatures to use with server classes + * + * @category Zend + * @package Zend_Server + * @subpackage Reflection + * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + * @version $Id$ + */ +class Zend_Server_Reflection +{ + /** + * Perform class reflection to create dispatch signatures + * + * Creates a {@link Zend_Server_Reflection_Class} object for the class or + * object provided. + * + * If extra arguments should be passed to dispatchable methods, these may + * be provided as an array to $argv. + * + * @param string|object $class Class name or object + * @param null|array $argv Optional arguments to be used during the method call + * @param string $namespace Optional namespace with which to prefix the + * method name (used for the signature key). Primarily to avoid collisions, + * also for XmlRpc namespacing + * @return Zend_Server_Reflection_Class + * @throws Zend_Server_Reflection_Exception + */ + public static function reflectClass($class, $argv = false, $namespace = '') + { + if (is_object($class)) { + $reflection = new ReflectionObject($class); + } elseif (class_exists($class)) { + $reflection = new ReflectionClass($class); + } else { + throw new Zend_Server_Reflection_Exception('Invalid class or object passed to attachClass()'); + } + + if ($argv && !is_array($argv)) { + throw new Zend_Server_Reflection_Exception('Invalid argv argument passed to reflectClass'); + } + + return new Zend_Server_Reflection_Class($reflection, $namespace, $argv); + } + + /** + * Perform function reflection to create dispatch signatures + * + * Creates dispatch prototypes for a function. It returns a + * {@link Zend_Server_Reflection_Function} object. + * + * If extra arguments should be passed to the dispatchable function, these + * may be provided as an array to $argv. + * + * @param string $function Function name + * @param null|array $argv Optional arguments to be used during the method call + * @param string $namespace Optional namespace with which to prefix the + * function name (used for the signature key). Primarily to avoid + * collisions, also for XmlRpc namespacing + * @return Zend_Server_Reflection_Function + * @throws Zend_Server_Reflection_Exception + */ + public static function reflectFunction($function, $argv = false, $namespace = '') + { + if (!is_string($function) || !function_exists($function)) { + throw new Zend_Server_Reflection_Exception('Invalid function "' . $function . '" passed to reflectFunction'); + } + + + if ($argv && !is_array($argv)) { + throw new Zend_Server_Reflection_Exception('Invalid argv argument passed to reflectClass'); + } + + return new Zend_Server_Reflection_Function(new ReflectionFunction($function), $namespace, $argv); + } +} diff --git a/library/vendor/Zend/Server/Reflection/Class.php b/library/vendor/Zend/Server/Reflection/Class.php new file mode 100644 index 0000000..9456f0a --- /dev/null +++ b/library/vendor/Zend/Server/Reflection/Class.php @@ -0,0 +1,195 @@ +<?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_Server + * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ + +/** + * Zend_Server_Reflection_Method + */ + +/** + * Class/Object reflection + * + * Proxies calls to a ReflectionClass object, and decorates getMethods() by + * creating its own list of {@link Zend_Server_Reflection_Method}s. + * + * @category Zend + * @package Zend_Server + * @subpackage Reflection + * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + * @version $Id$ + */ +class Zend_Server_Reflection_Class +{ + /** + * Optional configuration parameters; accessible via {@link __get} and + * {@link __set()} + * @var array + */ + protected $_config = array(); + + /** + * Array of {@link Zend_Server_Reflection_Method}s + * @var array + */ + protected $_methods = array(); + + /** + * Namespace + * @var string + */ + protected $_namespace = null; + + /** + * ReflectionClass object + * @var ReflectionClass + */ + protected $_reflection; + + /** + * Constructor + * + * Create array of dispatchable methods, each a + * {@link Zend_Server_Reflection_Method}. Sets reflection object property. + * + * @param ReflectionClass $reflection + * @param string $namespace + * @param mixed $argv + * @return void + */ + public function __construct(ReflectionClass $reflection, $namespace = null, $argv = false) + { + $this->_reflection = $reflection; + $this->setNamespace($namespace); + + foreach ($reflection->getMethods() as $method) { + // Don't aggregate magic methods + if ('__' == substr($method->getName(), 0, 2)) { + continue; + } + + if ($method->isPublic()) { + // Get signatures and description + $this->_methods[] = new Zend_Server_Reflection_Method($this, $method, $this->getNamespace(), $argv); + } + } + } + + /** + * Proxy reflection calls + * + * @param string $method + * @param array $args + * @return mixed + */ + public function __call($method, $args) + { + if (method_exists($this->_reflection, $method)) { + return call_user_func_array(array($this->_reflection, $method), $args); + } + + throw new Zend_Server_Reflection_Exception('Invalid reflection method'); + } + + /** + * Retrieve configuration parameters + * + * Values are retrieved by key from {@link $_config}. Returns null if no + * value found. + * + * @param string $key + * @return mixed + */ + public function __get($key) + { + if (isset($this->_config[$key])) { + return $this->_config[$key]; + } + + return null; + } + + /** + * Set configuration parameters + * + * Values are stored by $key in {@link $_config}. + * + * @param string $key + * @param mixed $value + * @return void + */ + public function __set($key, $value) + { + $this->_config[$key] = $value; + } + + /** + * Return array of dispatchable {@link Zend_Server_Reflection_Method}s. + * + * @access public + * @return array + */ + public function getMethods() + { + return $this->_methods; + } + + /** + * Get namespace for this class + * + * @return string + */ + public function getNamespace() + { + return $this->_namespace; + } + + /** + * Set namespace for this class + * + * @param string $namespace + * @return void + */ + public function setNamespace($namespace) + { + if (empty($namespace)) { + $this->_namespace = ''; + return; + } + + if (!is_string($namespace) || !preg_match('/[a-z0-9_\.]+/i', $namespace)) { + throw new Zend_Server_Reflection_Exception('Invalid namespace'); + } + + $this->_namespace = $namespace; + } + + /** + * Wakeup from serialization + * + * Reflection needs explicit instantiation to work correctly. Re-instantiate + * reflection object on wakeup. + * + * @return void + */ + public function __wakeup() + { + $this->_reflection = new ReflectionClass($this->getName()); + } +} diff --git a/library/vendor/Zend/Server/Reflection/Exception.php b/library/vendor/Zend/Server/Reflection/Exception.php new file mode 100644 index 0000000..e264768 --- /dev/null +++ b/library/vendor/Zend/Server/Reflection/Exception.php @@ -0,0 +1,37 @@ +<?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_Server + * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ + +/** + * @see Zend_Server_Exception + */ + +/** + * Zend_Server_Reflection exceptions + * + * @category Zend + * @package Zend_Server + * @subpackage Reflection + * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + * @version $Id$ + */ +class Zend_Server_Reflection_Exception extends Zend_Server_Exception +{ +} diff --git a/library/vendor/Zend/Server/Reflection/Function.php b/library/vendor/Zend/Server/Reflection/Function.php new file mode 100644 index 0000000..cd76afa --- /dev/null +++ b/library/vendor/Zend/Server/Reflection/Function.php @@ -0,0 +1,38 @@ +<?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_Server + * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ + +/** + * Zend_Server_Reflection_Function_Abstract + */ + +/** + * Function Reflection + * + * @uses Zend_Server_Reflection_Function_Abstract + * @category Zend + * @package Zend_Server + * @subpackage Reflection + * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + * @version $Id$ + */ +class Zend_Server_Reflection_Function extends Zend_Server_Reflection_Function_Abstract +{ +} diff --git a/library/vendor/Zend/Server/Reflection/Function/Abstract.php b/library/vendor/Zend/Server/Reflection/Function/Abstract.php new file mode 100644 index 0000000..f0557f8 --- /dev/null +++ b/library/vendor/Zend/Server/Reflection/Function/Abstract.php @@ -0,0 +1,506 @@ +<?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_Server + * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ + +/** + * Zend_Server_Reflection_Node + */ + +/** + * Zend_Server_Reflection_Parameter + */ + +/** + * Zend_Server_Reflection_Prototype + */ + +/** + * Function/Method Reflection + * + * Decorates a ReflectionFunction. Allows setting and retrieving an alternate + * 'service' name (i.e., the name to be used when calling via a service), + * setting and retrieving the description (originally set using the docblock + * contents), retrieving the callback and callback type, retrieving additional + * method invocation arguments, and retrieving the + * method {@link Zend_Server_Reflection_Prototype prototypes}. + * + * @category Zend + * @package Zend_Server + * @subpackage Reflection + * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + * @version $Id$ + */ +abstract class Zend_Server_Reflection_Function_Abstract +{ + /** + * @var ReflectionFunction + */ + protected $_reflection; + + /** + * Additional arguments to pass to method on invocation + * @var array + */ + protected $_argv = array(); + + /** + * Used to store extra configuration for the method (typically done by the + * server class, e.g., to indicate whether or not to instantiate a class). + * Associative array; access is as properties via {@link __get()} and + * {@link __set()} + * @var array + */ + protected $_config = array(); + + /** + * Declaring class (needed for when serialization occurs) + * @var string + */ + protected $_class; + + /** + * Function/method description + * @var string + */ + protected $_description = ''; + + /** + * Namespace with which to prefix function/method name + * @var string + */ + protected $_namespace; + + /** + * Prototypes + * @var array + */ + protected $_prototypes = array(); + + private $_return; + private $_returnDesc; + private $_paramDesc; + private $_sigParams; + private $_sigParamsDepth; + + /** + * Constructor + * + * @param ReflectionFunction $r + */ + public function __construct(Reflector $r, $namespace = null, $argv = array()) + { + // In PHP 5.1.x, ReflectionMethod extends ReflectionFunction. In 5.2.x, + // both extend ReflectionFunctionAbstract. So, we can't do normal type + // hinting in the prototype, but instead need to do some explicit + // testing here. + if ((!$r instanceof ReflectionFunction) + && (!$r instanceof ReflectionMethod)) { + throw new Zend_Server_Reflection_Exception('Invalid reflection class'); + } + $this->_reflection = $r; + + // Determine namespace + if (null !== $namespace){ + $this->setNamespace($namespace); + } + + // Determine arguments + if (is_array($argv)) { + $this->_argv = $argv; + } + + // If method call, need to store some info on the class + if ($r instanceof ReflectionMethod) { + $this->_class = $r->getDeclaringClass()->getName(); + } + + // Perform some introspection + $this->_reflect(); + } + + /** + * Create signature node tree + * + * Recursive method to build the signature node tree. Increments through + * each array in {@link $_sigParams}, adding every value of the next level + * to the current value (unless the current value is null). + * + * @param Zend_Server_Reflection_Node $parent + * @param int $level + * @return void + */ + protected function _addTree(Zend_Server_Reflection_Node $parent, $level = 0) + { + if ($level >= $this->_sigParamsDepth) { + return; + } + + foreach ($this->_sigParams[$level] as $value) { + $node = new Zend_Server_Reflection_Node($value, $parent); + if ((null !== $value) && ($this->_sigParamsDepth > $level + 1)) { + $this->_addTree($node, $level + 1); + } + } + } + + /** + * Build the signature tree + * + * Builds a signature tree starting at the return values and descending + * through each method argument. Returns an array of + * {@link Zend_Server_Reflection_Node}s. + * + * @return array + */ + protected function _buildTree() + { + $returnTree = array(); + foreach ((array) $this->_return as $value) { + $node = new Zend_Server_Reflection_Node($value); + $this->_addTree($node); + $returnTree[] = $node; + } + + return $returnTree; + } + + /** + * Build method signatures + * + * Builds method signatures using the array of return types and the array of + * parameters types + * + * @param array $return Array of return types + * @param string $returnDesc Return value description + * @param array $params Array of arguments (each an array of types) + * @param array $paramDesc Array of parameter descriptions + * @return array + */ + protected function _buildSignatures($return, $returnDesc, $paramTypes, $paramDesc) + { + $this->_return = $return; + $this->_returnDesc = $returnDesc; + $this->_paramDesc = $paramDesc; + $this->_sigParams = $paramTypes; + $this->_sigParamsDepth = count($paramTypes); + $signatureTrees = $this->_buildTree(); + $signatures = array(); + + $endPoints = array(); + foreach ($signatureTrees as $root) { + $tmp = $root->getEndPoints(); + if (empty($tmp)) { + $endPoints = array_merge($endPoints, array($root)); + } else { + $endPoints = array_merge($endPoints, $tmp); + } + } + + foreach ($endPoints as $node) { + if (!$node instanceof Zend_Server_Reflection_Node) { + continue; + } + + $signature = array(); + do { + array_unshift($signature, $node->getValue()); + $node = $node->getParent(); + } while ($node instanceof Zend_Server_Reflection_Node); + + $signatures[] = $signature; + } + + // Build prototypes + $params = $this->_reflection->getParameters(); + foreach ($signatures as $signature) { + $return = new Zend_Server_Reflection_ReturnValue(array_shift($signature), $this->_returnDesc); + $tmp = array(); + foreach ($signature as $key => $type) { + $param = new Zend_Server_Reflection_Parameter($params[$key], $type, (isset($this->_paramDesc[$key]) ? $this->_paramDesc[$key] : null)); + $param->setPosition($key); + $tmp[] = $param; + } + + $this->_prototypes[] = new Zend_Server_Reflection_Prototype($return, $tmp); + } + } + + /** + * Use code reflection to create method signatures + * + * Determines the method help/description text from the function DocBlock + * comment. Determines method signatures using a combination of + * ReflectionFunction and parsing of DocBlock @param and @return values. + * + * @param ReflectionFunction $function + * @return array + */ + protected function _reflect() + { + $function = $this->_reflection; + $helpText = ''; + $signatures = array(); + $returnDesc = ''; + $paramCount = $function->getNumberOfParameters(); + $paramCountRequired = $function->getNumberOfRequiredParameters(); + $parameters = $function->getParameters(); + $docBlock = $function->getDocComment(); + + if (!empty($docBlock)) { + // Get help text + if (preg_match(':/\*\*\s*\r?\n\s*\*\s(.*?)\r?\n\s*\*(\s@|/):s', $docBlock, $matches)) + { + $helpText = $matches[1]; + $helpText = preg_replace('/(^\s*\*\s)/m', '', $helpText); + $helpText = preg_replace('/\r?\n\s*\*\s*(\r?\n)*/s', "\n", $helpText); + $helpText = trim($helpText); + } + + // Get return type(s) and description + $return = 'void'; + if (preg_match('/@return\s+(\S+)/', $docBlock, $matches)) { + $return = explode('|', $matches[1]); + if (preg_match('/@return\s+\S+\s+(.*?)(@|\*\/)/s', $docBlock, $matches)) + { + $value = $matches[1]; + $value = preg_replace('/\s?\*\s/m', '', $value); + $value = preg_replace('/\s{2,}/', ' ', $value); + $returnDesc = trim($value); + } + } + + // Get param types and description + if (preg_match_all('/@param\s+([^\s]+)/m', $docBlock, $matches)) { + $paramTypesTmp = $matches[1]; + if (preg_match_all('/@param\s+\S+\s+(\$\S+)\s+(.*?)(?=@|\*\/)/s', $docBlock, $matches)) + { + $paramDesc = $matches[2]; + foreach ($paramDesc as $key => $value) { + $value = preg_replace('/\s?\*\s/m', '', $value); + $value = preg_replace('/\s{2,}/', ' ', $value); + $paramDesc[$key] = trim($value); + } + } + } + } else { + $helpText = $function->getName(); + $return = 'void'; + + // Try and auto-determine type, based on reflection + $paramTypesTmp = array(); + foreach ($parameters as $i => $param) { + $paramType = 'mixed'; + if ($param->isArray()) { + $paramType = 'array'; + } + $paramTypesTmp[$i] = $paramType; + } + } + + // Set method description + $this->setDescription($helpText); + + // Get all param types as arrays + if (!isset($paramTypesTmp) && (0 < $paramCount)) { + $paramTypesTmp = array_fill(0, $paramCount, 'mixed'); + } elseif (!isset($paramTypesTmp)) { + $paramTypesTmp = array(); + } elseif (count($paramTypesTmp) < $paramCount) { + $start = $paramCount - count($paramTypesTmp); + for ($i = $start; $i < $paramCount; ++$i) { + $paramTypesTmp[$i] = 'mixed'; + } + } + + // Get all param descriptions as arrays + if (!isset($paramDesc) && (0 < $paramCount)) { + $paramDesc = array_fill(0, $paramCount, ''); + } elseif (!isset($paramDesc)) { + $paramDesc = array(); + } elseif (count($paramDesc) < $paramCount) { + $start = $paramCount - count($paramDesc); + for ($i = $start; $i < $paramCount; ++$i) { + $paramDesc[$i] = ''; + } + } + + if (count($paramTypesTmp) != $paramCount) { + throw new Zend_Server_Reflection_Exception( + 'Variable number of arguments is not supported for services (except optional parameters). ' + . 'Number of function arguments in ' . $function->getDeclaringClass()->getName() . '::' + . $function->getName() . '() must correspond to actual number of arguments described in the ' + . 'docblock.'); + } + + $paramTypes = array(); + foreach ($paramTypesTmp as $i => $param) { + $tmp = explode('|', $param); + if ($parameters[$i]->isOptional()) { + array_unshift($tmp, null); + } + $paramTypes[] = $tmp; + } + + $this->_buildSignatures($return, $returnDesc, $paramTypes, $paramDesc); + } + + + /** + * Proxy reflection calls + * + * @param string $method + * @param array $args + * @return mixed + */ + public function __call($method, $args) + { + if (method_exists($this->_reflection, $method)) { + return call_user_func_array(array($this->_reflection, $method), $args); + } + + throw new Zend_Server_Reflection_Exception('Invalid reflection method ("' .$method. '")'); + } + + /** + * Retrieve configuration parameters + * + * Values are retrieved by key from {@link $_config}. Returns null if no + * value found. + * + * @param string $key + * @return mixed + */ + public function __get($key) + { + if (isset($this->_config[$key])) { + return $this->_config[$key]; + } + + return null; + } + + /** + * Set configuration parameters + * + * Values are stored by $key in {@link $_config}. + * + * @param string $key + * @param mixed $value + * @return void + */ + public function __set($key, $value) + { + $this->_config[$key] = $value; + } + + /** + * Set method's namespace + * + * @param string $namespace + * @return void + */ + public function setNamespace($namespace) + { + if (empty($namespace)) { + $this->_namespace = ''; + return; + } + + if (!is_string($namespace) || !preg_match('/[a-z0-9_\.]+/i', $namespace)) { + throw new Zend_Server_Reflection_Exception('Invalid namespace'); + } + + $this->_namespace = $namespace; + } + + /** + * Return method's namespace + * + * @return string + */ + public function getNamespace() + { + return $this->_namespace; + } + + /** + * Set the description + * + * @param string $string + * @return void + */ + public function setDescription($string) + { + if (!is_string($string)) { + throw new Zend_Server_Reflection_Exception('Invalid description'); + } + + $this->_description = $string; + } + + /** + * Retrieve the description + * + * @return void + */ + public function getDescription() + { + return $this->_description; + } + + /** + * Retrieve all prototypes as array of + * {@link Zend_Server_Reflection_Prototype Zend_Server_Reflection_Prototypes} + * + * @return array + */ + public function getPrototypes() + { + return $this->_prototypes; + } + + /** + * Retrieve additional invocation arguments + * + * @return array + */ + public function getInvokeArguments() + { + return $this->_argv; + } + + /** + * Wakeup from serialization + * + * Reflection needs explicit instantiation to work correctly. Re-instantiate + * reflection object on wakeup. + * + * @return void + */ + public function __wakeup() + { + if ($this->_reflection instanceof ReflectionMethod) { + $class = new ReflectionClass($this->_class); + $this->_reflection = new ReflectionMethod($class->newInstance(), $this->getName()); + } else { + $this->_reflection = new ReflectionFunction($this->getName()); + } + } +} diff --git a/library/vendor/Zend/Server/Reflection/Method.php b/library/vendor/Zend/Server/Reflection/Method.php new file mode 100644 index 0000000..305b783 --- /dev/null +++ b/library/vendor/Zend/Server/Reflection/Method.php @@ -0,0 +1,109 @@ +<?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_Server + * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ + +/** + * Zend_Server_Reflection_Function_Abstract + */ + +/** + * Method Reflection + * + * @uses Zend_Server_Reflection_Function_Abstract + * @category Zend + * @package Zend_Server + * @subpackage Reflection + * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + * @version $Id$ + */ +class Zend_Server_Reflection_Method extends Zend_Server_Reflection_Function_Abstract +{ + /** + * Parent class name + * @var string + */ + protected $_class; + + /** + * Parent class reflection + * @var Zend_Server_Reflection_Class + */ + protected $_classReflection; + + /** + * Constructor + * + * @param Zend_Server_Reflection_Class $class + * @param ReflectionMethod $r + * @param string $namespace + * @param array $argv + * @return void + */ + public function __construct(Zend_Server_Reflection_Class $class, ReflectionMethod $r, $namespace = null, $argv = array()) + { + $this->_classReflection = $class; + $this->_reflection = $r; + + $classNamespace = $class->getNamespace(); + + // Determine namespace + if (!empty($namespace)) { + $this->setNamespace($namespace); + } elseif (!empty($classNamespace)) { + $this->setNamespace($classNamespace); + } + + // Determine arguments + if (is_array($argv)) { + $this->_argv = $argv; + } + + // If method call, need to store some info on the class + $this->_class = $class->getName(); + + // Perform some introspection + $this->_reflect(); + } + + /** + * Return the reflection for the class that defines this method + * + * @return Zend_Server_Reflection_Class + */ + public function getDeclaringClass() + { + return $this->_classReflection; + } + + /** + * Wakeup from serialization + * + * Reflection needs explicit instantiation to work correctly. Re-instantiate + * reflection object on wakeup. + * + * @return void + */ + public function __wakeup() + { + $this->_classReflection = new Zend_Server_Reflection_Class(new ReflectionClass($this->_class), $this->getNamespace(), $this->getInvokeArguments()); + $this->_reflection = new ReflectionMethod($this->_classReflection->getName(), $this->getName()); + } + +} diff --git a/library/vendor/Zend/Server/Reflection/Node.php b/library/vendor/Zend/Server/Reflection/Node.php new file mode 100644 index 0000000..d80abf3 --- /dev/null +++ b/library/vendor/Zend/Server/Reflection/Node.php @@ -0,0 +1,201 @@ +<?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_Server + * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ + +/** + * Node Tree class for Zend_Server reflection operations + * + * @category Zend + * @package Zend_Server + * @subpackage Reflection + * @version $Id$ + * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ +class Zend_Server_Reflection_Node +{ + /** + * Node value + * @var mixed + */ + protected $_value = null; + + /** + * Array of child nodes (if any) + * @var array + */ + protected $_children = array(); + + /** + * Parent node (if any) + * @var Zend_Server_Reflection_Node + */ + protected $_parent = null; + + /** + * Constructor + * + * @param mixed $value + * @param Zend_Server_Reflection_Node $parent Optional + * @return Zend_Server_Reflection_Node + */ + public function __construct($value, Zend_Server_Reflection_Node $parent = null) + { + $this->_value = $value; + if (null !== $parent) { + $this->setParent($parent, true); + } + + return $this; + } + + /** + * Set parent node + * + * @param Zend_Server_Reflection_Node $node + * @param boolean $new Whether or not the child node is newly created + * and should always be attached + * @return void + */ + public function setParent(Zend_Server_Reflection_Node $node, $new = false) + { + $this->_parent = $node; + + if ($new) { + $node->attachChild($this); + return; + } + } + + /** + * Create and attach a new child node + * + * @param mixed $value + * @access public + * @return Zend_Server_Reflection_Node New child node + */ + public function createChild($value) + { + $child = new self($value, $this); + + return $child; + } + + /** + * Attach a child node + * + * @param Zend_Server_Reflection_Node $node + * @return void + */ + public function attachChild(Zend_Server_Reflection_Node $node) + { + $this->_children[] = $node; + + if ($node->getParent() !== $this) { + $node->setParent($this); + } + } + + /** + * Return an array of all child nodes + * + * @return array + */ + public function getChildren() + { + return $this->_children; + } + + /** + * Does this node have children? + * + * @return boolean + */ + public function hasChildren() + { + return count($this->_children) > 0; + } + + /** + * Return the parent node + * + * @return null|Zend_Server_Reflection_Node + */ + public function getParent() + { + return $this->_parent; + } + + /** + * Return the node's current value + * + * @return mixed + */ + public function getValue() + { + return $this->_value; + } + + /** + * Set the node value + * + * @param mixed $value + * @return void + */ + public function setValue($value) + { + $this->_value = $value; + } + + /** + * Retrieve the bottommost nodes of this node's tree + * + * Retrieves the bottommost nodes of the tree by recursively calling + * getEndPoints() on all children. If a child is null, it returns the parent + * as an end point. + * + * @return array + */ + public function getEndPoints() + { + $endPoints = array(); + if (!$this->hasChildren()) { + return $endPoints; + } + + foreach ($this->_children as $child) { + $value = $child->getValue(); + + if (null === $value) { + $endPoints[] = $this; + } elseif ((null !== $value) + && $child->hasChildren()) + { + $childEndPoints = $child->getEndPoints(); + if (!empty($childEndPoints)) { + $endPoints = array_merge($endPoints, $childEndPoints); + } + } elseif ((null !== $value) && !$child->hasChildren()) { + $endPoints[] = $child; + } + } + + return $endPoints; + } +} diff --git a/library/vendor/Zend/Server/Reflection/Parameter.php b/library/vendor/Zend/Server/Reflection/Parameter.php new file mode 100644 index 0000000..681824a --- /dev/null +++ b/library/vendor/Zend/Server/Reflection/Parameter.php @@ -0,0 +1,158 @@ +<?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_Server + * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ + +/** + * Parameter Reflection + * + * Decorates a ReflectionParameter to allow setting the parameter type + * + * @category Zend + * @package Zend_Server + * @subpackage Reflection + * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + * @version $Id$ + */ +class Zend_Server_Reflection_Parameter +{ + /** + * @var ReflectionParameter + */ + protected $_reflection; + + /** + * Parameter position + * @var int + */ + protected $_position; + + /** + * Parameter type + * @var string + */ + protected $_type; + + /** + * Parameter description + * @var string + */ + protected $_description; + + /** + * Constructor + * + * @param ReflectionParameter $r + * @param string $type Parameter type + * @param string $description Parameter description + */ + public function __construct(ReflectionParameter $r, $type = 'mixed', $description = '') + { + $this->_reflection = $r; + $this->setType($type); + $this->setDescription($description); + } + + /** + * Proxy reflection calls + * + * @param string $method + * @param array $args + * @return mixed + */ + public function __call($method, $args) + { + if (method_exists($this->_reflection, $method)) { + return call_user_func_array(array($this->_reflection, $method), $args); + } + + throw new Zend_Server_Reflection_Exception('Invalid reflection method'); + } + + /** + * Retrieve parameter type + * + * @return string + */ + public function getType() + { + return $this->_type; + } + + /** + * Set parameter type + * + * @param string|null $type + * @return void + */ + public function setType($type) + { + if (!is_string($type) && (null !== $type)) { + throw new Zend_Server_Reflection_Exception('Invalid parameter type'); + } + + $this->_type = $type; + } + + /** + * Retrieve parameter description + * + * @return string + */ + public function getDescription() + { + return $this->_description; + } + + /** + * Set parameter description + * + * @param string|null $description + * @return void + */ + public function setDescription($description) + { + if (!is_string($description) && (null !== $description)) { + throw new Zend_Server_Reflection_Exception('Invalid parameter description'); + } + + $this->_description = $description; + } + + /** + * Set parameter position + * + * @param int $index + * @return void + */ + public function setPosition($index) + { + $this->_position = (int) $index; + } + + /** + * Return parameter position + * + * @return int + */ + public function getPosition() + { + return $this->_position; + } +} diff --git a/library/vendor/Zend/Server/Reflection/Prototype.php b/library/vendor/Zend/Server/Reflection/Prototype.php new file mode 100644 index 0000000..e780623 --- /dev/null +++ b/library/vendor/Zend/Server/Reflection/Prototype.php @@ -0,0 +1,99 @@ +<?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_Server + * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ + +/** + * Zend_Server_Reflection_ReturnValue + */ + +/** + * Zend_Server_Reflection_Parameter + */ + +/** + * Method/Function prototypes + * + * Contains accessors for the return value and all method arguments. + * + * @category Zend + * @package Zend_Server + * @subpackage Reflection + * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + * @version $Id$ + */ +class Zend_Server_Reflection_Prototype +{ + /** + * Constructor + * + * @param Zend_Server_Reflection_ReturnValue $return + * @param array $params + * @return void + */ + public function __construct(Zend_Server_Reflection_ReturnValue $return, $params = null) + { + $this->_return = $return; + + if (!is_array($params) && (null !== $params)) { + throw new Zend_Server_Reflection_Exception('Invalid parameters'); + } + + if (is_array($params)) { + foreach ($params as $param) { + if (!$param instanceof Zend_Server_Reflection_Parameter) { + throw new Zend_Server_Reflection_Exception('One or more params are invalid'); + } + } + } + + $this->_params = $params; + } + + /** + * Retrieve return type + * + * @return string + */ + public function getReturnType() + { + return $this->_return->getType(); + } + + /** + * Retrieve the return value object + * + * @access public + * @return Zend_Server_Reflection_ReturnValue + */ + public function getReturnValue() + { + return $this->_return; + } + + /** + * Retrieve method parameters + * + * @return array Array of {@link Zend_Server_Reflection_Parameter}s + */ + public function getParameters() + { + return $this->_params; + } +} diff --git a/library/vendor/Zend/Server/Reflection/ReturnValue.php b/library/vendor/Zend/Server/Reflection/ReturnValue.php new file mode 100644 index 0000000..dcc5132 --- /dev/null +++ b/library/vendor/Zend/Server/Reflection/ReturnValue.php @@ -0,0 +1,108 @@ +<?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_Server + * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ + +/** + * Return value reflection + * + * Stores the return value type and description + * + * @category Zend + * @package Zend_Server + * @subpackage Reflection + * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + * @version $Id$ + */ +class Zend_Server_Reflection_ReturnValue +{ + /** + * Return value type + * @var string + */ + protected $_type; + + /** + * Return value description + * @var string + */ + protected $_description; + + /** + * Constructor + * + * @param string $type Return value type + * @param string $description Return value type + */ + public function __construct($type = 'mixed', $description = '') + { + $this->setType($type); + $this->setDescription($description); + } + + /** + * Retrieve parameter type + * + * @return string + */ + public function getType() + { + return $this->_type; + } + + /** + * Set parameter type + * + * @param string|null $type + * @return void + */ + public function setType($type) + { + if (!is_string($type) && (null !== $type)) { + throw new Zend_Server_Reflection_Exception('Invalid parameter type'); + } + + $this->_type = $type; + } + + /** + * Retrieve parameter description + * + * @return string + */ + public function getDescription() + { + return $this->_description; + } + + /** + * Set parameter description + * + * @param string|null $description + * @return void + */ + public function setDescription($description) + { + if (!is_string($description) && (null !== $description)) { + throw new Zend_Server_Reflection_Exception('Invalid parameter description'); + } + + $this->_description = $description; + } +} |