1: <?php
2:
3: 4: 5: 6: 7: 8: 9: 10:
11:
12: namespace Nette\Reflection;
13:
14: use Nette,
15: Nette\ObjectMixin,
16: Nette\Annotations;
17:
18:
19:
20: 21: 22: 23: 24:
25: class FunctionReflection extends \ReflectionFunction
26: {
27:
28: private $value;
29:
30:
31: public function __construct($name)
32: {
33: parent::__construct($this->value = $name);
34: }
35:
36:
37:
38: public function __toString()
39: {
40: return 'Function ' . $this->getName() . '()';
41: }
42:
43:
44:
45: public function getClosure()
46: {
47: return $this->isClosure() ? $this->value : NULL;
48: }
49:
50:
51:
52:
53:
54:
55:
56: 57: 58:
59: public function getExtension()
60: {
61: return ($name = $this->getExtensionName()) ? new ExtensionReflection($name) : NULL;
62: }
63:
64:
65:
66: public function getParameters()
67: {
68: foreach ($res = parent::getParameters() as $key => $val) {
69: $res[$key] = new ParameterReflection($this->value, $val->getName());
70: }
71: return $res;
72: }
73:
74:
75:
76:
77:
78:
79:
80: 81: 82:
83: public static function getReflection()
84: {
85: return new Nette\Reflection\ClassReflection(get_called_class());
86: }
87:
88:
89:
90: public function __call($name, $args)
91: {
92: return ObjectMixin::call($this, $name, $args);
93: }
94:
95:
96:
97: public function &__get($name)
98: {
99: return ObjectMixin::get($this, $name);
100: }
101:
102:
103:
104: public function __set($name, $value)
105: {
106: return ObjectMixin::set($this, $name, $value);
107: }
108:
109:
110:
111: public function __isset($name)
112: {
113: return ObjectMixin::has($this, $name);
114: }
115:
116:
117:
118: public function __unset($name)
119: {
120: throw new \MemberAccessException("Cannot unset the property {$this->reflection->name}::\$$name.");
121: }
122:
123: }
124: