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 Property extends \ReflectionProperty
25: {
26:
27: public function __toString()
28: {
29: return 'Property ' . parent::getDeclaringClass()->getName() . '::$' . $this->getName();
30: }
31:
32:
33:
34:
35:
36:
37:
38: 39: 40:
41: public function getDeclaringClass()
42: {
43: return new ClassType(parent::getDeclaringClass()->getName());
44: }
45:
46:
47:
48:
49:
50:
51:
52: 53: 54: 55: 56:
57: public function hasAnnotation($name)
58: {
59: $res = AnnotationsParser::getAll($this);
60: return !empty($res[$name]);
61: }
62:
63:
64:
65: 66: 67: 68: 69:
70: public function getAnnotation($name)
71: {
72: $res = AnnotationsParser::getAll($this);
73: return isset($res[$name]) ? end($res[$name]) : NULL;
74: }
75:
76:
77:
78: 79: 80: 81:
82: public function getAnnotations()
83: {
84: return AnnotationsParser::getAll($this);
85: }
86:
87:
88:
89: 90: 91: 92:
93: public function getDescription()
94: {
95: return $this->getAnnotation('description');
96: }
97:
98:
99:
100:
101:
102:
103:
104: 105: 106:
107: public static function getReflection()
108: {
109: return new ClassType(get_called_class());
110: }
111:
112:
113:
114: public function __call($name, $args)
115: {
116: return ObjectMixin::call($this, $name, $args);
117: }
118:
119:
120:
121: public function &__get($name)
122: {
123: return ObjectMixin::get($this, $name);
124: }
125:
126:
127:
128: public function __set($name, $value)
129: {
130: return ObjectMixin::set($this, $name, $value);
131: }
132:
133:
134:
135: public function __isset($name)
136: {
137: return ObjectMixin::has($this, $name);
138: }
139:
140:
141:
142: public function __unset($name)
143: {
144: ObjectMixin::remove($this, $name);
145: }
146:
147: }
148: