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