Namespaces

  • Nette
    • Application
    • Caching
    • Collections
    • Config
    • Forms
    • IO
    • Loaders
    • Mail
    • Reflection
    • Security
    • Templates
    • Web
  • None
  • PHP

Classes

  • Annotation
  • AnnotationsParser
  • ClassReflection
  • ExtensionReflection
  • FunctionReflection
  • MethodReflection
  • ParameterReflection
  • PropertyReflection

Interfaces

  • IAnnotation
  • Overview
  • Namespace
  • Class
  • Tree
  • Other releases
  1: <?php
  2: 
  3: /**
  4:  * This file is part of the Nette Framework (https://nette.org)
  5:  *
  6:  * Copyright (c) 2004 David Grudl (http://davidgrudl.com)
  7:  *
  8:  * For the full copyright and license information, please view
  9:  * the file license.txt that was distributed with this source code.
 10:  */
 11: 
 12: namespace Nette\Reflection;
 13: 
 14: use Nette,
 15:     Nette\ObjectMixin,
 16:     Nette\Annotations;
 17: 
 18: 
 19: 
 20: /**
 21:  * Reports information about a function.
 22:  *
 23:  * @author     David Grudl
 24:  */
 25: class FunctionReflection extends \ReflectionFunction
 26: {
 27:     /** @var string|Closure */
 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:     /********************* Reflection layer ****************d*g**/
 53: 
 54: 
 55: 
 56:     /**
 57:      * @return Nette\Reflection\ExtensionReflection
 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:     /********************* Nette\Object behaviour ****************d*g**/
 77: 
 78: 
 79: 
 80:     /**
 81:      * @return Nette\Reflection\ClassReflection
 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: 
Nette Framework 0.9.7 API documentation generated by ApiGen 2.3.0