1: <?php
2:
3: 4: 5: 6: 7: 8: 9: 10:
11:
12: namespace Nette\Reflection;
13:
14: use Nette,
15: Nette\ObjectMixin,
16: Nette\Annotations;
17:
18:
19:
20: 21: 22: 23: 24:
25: class ParameterReflection extends \ReflectionParameter
26: {
27:
28: private $function;
29:
30:
31: public function __construct($function, $parameter)
32: {
33: parent::__construct($this->function = $function, $parameter);
34: }
35:
36:
37:
38: 39: 40:
41: public function getClass()
42: {
43: return ($ref = parent::getClass()) ? new ClassReflection($ref->getName()) : NULL;
44: }
45:
46:
47:
48: 49: 50:
51: public function getClassName()
52: {
53: return ($tmp = Nette\String::match($this, '#>\s+([a-z0-9_\\\\]+)#i')) ? $tmp[1] : NULL;
54: }
55:
56:
57:
58: 59: 60:
61: public function getDeclaringClass()
62: {
63: return ($ref = parent::getDeclaringClass()) ? new ClassReflection($ref->getName()) : NULL;
64: }
65:
66:
67:
68: 69: 70:
71: public function getDeclaringFunction()
72: {
73: return is_array($this->function) ? new MethodReflection($this->function[0], $this->function[1]) : new FunctionReflection($this->function);
74: }
75:
76:
77:
78:
79:
80:
81:
82: 83: 84:
85: public static function getReflection()
86: {
87: return new Nette\Reflection\ClassReflection(get_called_class());
88: }
89:
90:
91:
92: public function __call($name, $args)
93: {
94: return ObjectMixin::call($this, $name, $args);
95: }
96:
97:
98:
99: public function &__get($name)
100: {
101: return ObjectMixin::get($this, $name);
102: }
103:
104:
105:
106: public function __set($name, $value)
107: {
108: return ObjectMixin::set($this, $name, $value);
109: }
110:
111:
112:
113: public function __isset($name)
114: {
115: return ObjectMixin::has($this, $name);
116: }
117:
118:
119:
120: public function __unset($name)
121: {
122: throw new \MemberAccessException("Cannot unset the property {$this->reflection->name}::\$$name.");
123: }
124:
125: }
126: