Added the zend framework 2 library, the path is specified in line no.26 in zend_modul...
[openemr.git] / interface / modules / zend_modules / library / Zend / Server / Reflection.php
blobdb85debb52c45752ad345bdd5cce26aec682a1fa
1 <?php
2 /**
3 * Zend Framework (http://framework.zend.com/)
5 * @link http://github.com/zendframework/zf2 for the canonical source repository
6 * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
7 * @license http://framework.zend.com/license/new-bsd New BSD License
8 */
10 namespace Zend\Server;
12 use Zend\Server\Reflection\ReflectionClass;
13 use Zend\Server\Reflection\ReflectionFunction;
15 /**
16 * Reflection for determining method signatures to use with server classes
18 class Reflection
20 /**
21 * Perform class reflection to create dispatch signatures
23 * Creates a {@link \Zend\Server\Reflection\ClassReflection} object for the class or
24 * object provided.
26 * If extra arguments should be passed to dispatchable methods, these may
27 * be provided as an array to $argv.
29 * @param string|object $class Class name or object
30 * @param bool|array $argv Optional arguments to be used during the method call
31 * @param string $namespace Optional namespace with which to prefix the
32 * method name (used for the signature key). Primarily to avoid collisions,
33 * also for XmlRpc namespacing
34 * @return \Zend\Server\Reflection\ReflectionClass
35 * @throws \Zend\Server\Reflection\Exception\InvalidArgumentException
37 public static function reflectClass($class, $argv = false, $namespace = '')
39 if (is_object($class)) {
40 $reflection = new \ReflectionObject($class);
41 } elseif (class_exists($class)) {
42 $reflection = new \ReflectionClass($class);
43 } else {
44 throw new Reflection\Exception\InvalidArgumentException('Invalid class or object passed to attachClass()');
47 if ($argv && !is_array($argv)) {
48 throw new Reflection\Exception\InvalidArgumentException('Invalid argv argument passed to reflectClass');
51 return new ReflectionClass($reflection, $namespace, $argv);
54 /**
55 * Perform function reflection to create dispatch signatures
57 * Creates dispatch prototypes for a function. It returns a
58 * {@link Zend\Server\Reflection\FunctionReflection} object.
60 * If extra arguments should be passed to the dispatchable function, these
61 * may be provided as an array to $argv.
63 * @param string $function Function name
64 * @param bool|array $argv Optional arguments to be used during the method call
65 * @param string $namespace Optional namespace with which to prefix the
66 * function name (used for the signature key). Primarily to avoid
67 * collisions, also for XmlRpc namespacing
68 * @return \Zend\Server\Reflection\ReflectionFunction
69 * @throws \Zend\Server\Reflection\Exception\InvalidArgumentException
71 public static function reflectFunction($function, $argv = false, $namespace = '')
73 if (!is_string($function) || !function_exists($function)) {
74 throw new Reflection\Exception\InvalidArgumentException('Invalid function "' . $function . '" passed to reflectFunction');
77 if ($argv && !is_array($argv)) {
78 throw new Reflection\Exception\InvalidArgumentException('Invalid argv argument passed to reflectClass');
81 return new ReflectionFunction(new \ReflectionFunction($function), $namespace, $argv);