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