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 PropertyReflection 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 ClassReflection(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: 94: 95:
96: public static function getReflection()
97: {
98: return new ClassReflection(get_called_class());
99: }
100:
101:
102:
103: public function __call($name, $args)
104: {
105: return ObjectMixin::call($this, $name, $args);
106: }
107:
108:
109:
110: public function &__get($name)
111: {
112: return ObjectMixin::get($this, $name);
113: }
114:
115:
116:
117: public function __set($name, $value)
118: {
119: return ObjectMixin::set($this, $name, $value);
120: }
121:
122:
123:
124: public function __isset($name)
125: {
126: return ObjectMixin::has($this, $name);
127: }
128:
129:
130:
131: public function __unset($name)
132: {
133: ObjectMixin::remove($this, $name);
134: }
135:
136: }
137: