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