1: <?php
2:
3: 4: 5: 6: 7: 8: 9: 10: 11:
12:
13:
14:
15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31:
32: class ParameterReflection extends ReflectionParameter
33: {
34:
35: private $function;
36:
37:
38: public function __construct($function, $parameter)
39: {
40: parent::__construct($this->function = $function, $parameter);
41: }
42:
43:
44:
45: 46: 47:
48: public function getClass()
49: {
50: return ($ref = parent::getClass()) ? new ClassReflection($ref->getName()) : NULL;
51: }
52:
53:
54:
55: 56: 57:
58: public function getClassName()
59: {
60: try {
61: return ($ref = parent::getClass()) ? $ref->getName() : NULL;
62: } catch (ReflectionException $e) {
63: if (preg_match('#Class (.+) does not exist#', $e->getMessage(), $m)) {
64: return $m[1];
65: }
66: throw $e;
67: }
68: }
69:
70:
71:
72: 73: 74:
75: public function getDeclaringClass()
76: {
77: return ($ref = parent::getDeclaringClass()) ? new ClassReflection($ref->getName()) : NULL;
78: }
79:
80:
81:
82: 83: 84:
85: public function getDeclaringFunction()
86: {
87: return is_array($this->function)
88: ? new MethodReflection($this->function[0], $this->function[1])
89: : new FunctionReflection($this->function);
90: }
91:
92:
93:
94: public function __toString()
95: {
96: return 'Parameter $' . parent::getName() . ' in ' . $this->getDeclaringFunction();
97: }
98:
99:
100:
101:
102:
103:
104:
105: 106: 107:
108: public function getReflection()
109: {
110: return new ClassReflection($this);
111: }
112:
113:
114:
115: public function __call($name, $args)
116: {
117: return ObjectMixin::call($this, $name, $args);
118: }
119:
120:
121:
122: public function &__get($name)
123: {
124: return ObjectMixin::get($this, $name);
125: }
126:
127:
128:
129: public function __set($name, $value)
130: {
131: return ObjectMixin::set($this, $name, $value);
132: }
133:
134:
135:
136: public function __isset($name)
137: {
138: return ObjectMixin::has($this, $name);
139: }
140:
141:
142:
143: public function __unset($name)
144: {
145: ObjectMixin::remove($this, $name);
146: }
147:
148: }
149: