1: <?php
2:
3: 4: 5: 6:
7:
8: namespace Nette\Reflection;
9:
10: use Nette,
11: 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 'Property ' . 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: return new ClassType(get_called_class());
109: }
110:
111:
112: public function __call($name, $args)
113: {
114: return ObjectMixin::call($this, $name, $args);
115: }
116:
117:
118: public function &__get($name)
119: {
120: return ObjectMixin::get($this, $name);
121: }
122:
123:
124: public function __set($name, $value)
125: {
126: ObjectMixin::set($this, $name, $value);
127: }
128:
129:
130: public function __isset($name)
131: {
132: return ObjectMixin::has($this, $name);
133: }
134:
135:
136: public function __unset($name)
137: {
138: ObjectMixin::remove($this, $name);
139: }
140:
141: }
142: