Namespaces

  • Nette
    • Application
      • Diagnostics
      • Responses
      • Routers
      • UI
    • Caching
      • Storages
    • ComponentModel
    • Config
      • Adapters
      • Extensions
    • Database
      • Diagnostics
      • Drivers
      • Reflection
      • Table
    • DI
      • Diagnostics
    • Diagnostics
    • Forms
      • Controls
      • Rendering
    • Http
    • Iterators
    • Latte
      • Macros
    • Loaders
    • Localization
    • Mail
    • Reflection
    • Security
      • Diagnostics
    • Templating
    • Utils
      • PhpGenerator
  • NetteModule
  • None
  • PHP

Classes

  • Annotation
  • AnnotationsParser
  • ClassType
  • Extension
  • GlobalFunction
  • Method
  • Parameter
  • Property

Interfaces

  • IAnnotation
  • Overview
  • Namespace
  • Class
  • Tree
  1: <?php
  2: 
  3: /**
  4:  * This file is part of the Nette Framework (http://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: 
 17: 
 18: 
 19: /**
 20:  * Reports information about a function.
 21:  *
 22:  * @author     David Grudl
 23:  * @property-read array $defaultParameters
 24:  * @property-read bool $closure
 25:  * @property-read Extension $extension
 26:  * @property-read Parameter[] $parameters
 27:  * @property-read bool $disabled
 28:  * @property-read bool $deprecated
 29:  * @property-read bool $internal
 30:  * @property-read bool $userDefined
 31:  * @property-read string $docComment
 32:  * @property-read int $endLine
 33:  * @property-read string $extensionName
 34:  * @property-read string $fileName
 35:  * @property-read string $name
 36:  * @property-read string $namespaceName
 37:  * @property-read int $numberOfParameters
 38:  * @property-read int $numberOfRequiredParameters
 39:  * @property-read string $shortName
 40:  * @property-read int $startLine
 41:  * @property-read array $staticVariables
 42:  */
 43: class GlobalFunction extends \ReflectionFunction
 44: {
 45:     /** @var string|Closure */
 46:     private $value;
 47: 
 48: 
 49:     public function __construct($name)
 50:     {
 51:         parent::__construct($this->value = $name);
 52:     }
 53: 
 54: 
 55: 
 56:     /**
 57:      * @return Nette\Callback
 58:      */
 59:     public function toCallback()
 60:     {
 61:         return new Nette\Callback($this->value);
 62:     }
 63: 
 64: 
 65: 
 66:     public function __toString()
 67:     {
 68:         return 'Function ' . $this->getName() . '()';
 69:     }
 70: 
 71: 
 72: 
 73:     public function getClosure()
 74:     {
 75:         return $this->isClosure() ? $this->value : NULL;
 76:     }
 77: 
 78: 
 79: 
 80:     /********************* Reflection layer ****************d*g**/
 81: 
 82: 
 83: 
 84:     /**
 85:      * @return Extension
 86:      */
 87:     public function getExtension()
 88:     {
 89:         return ($name = $this->getExtensionName()) ? new Extension($name) : NULL;
 90:     }
 91: 
 92: 
 93: 
 94:     /**
 95:      * @return Parameter[]
 96:      */
 97:     public function getParameters()
 98:     {
 99:         foreach ($res = parent::getParameters() as $key => $val) {
100:             $res[$key] = new Parameter($this->value, $val->getName());
101:         }
102:         return $res;
103:     }
104: 
105: 
106: 
107:     /********************* Nette\Object behaviour ****************d*g**/
108: 
109: 
110: 
111:     /**
112:      * @return ClassType
113:      */
114:     public static function getReflection()
115:     {
116:         return new ClassType(get_called_class());
117:     }
118: 
119: 
120: 
121:     public function __call($name, $args)
122:     {
123:         return ObjectMixin::call($this, $name, $args);
124:     }
125: 
126: 
127: 
128:     public function &__get($name)
129:     {
130:         return ObjectMixin::get($this, $name);
131:     }
132: 
133: 
134: 
135:     public function __set($name, $value)
136:     {
137:         return ObjectMixin::set($this, $name, $value);
138:     }
139: 
140: 
141: 
142:     public function __isset($name)
143:     {
144:         return ObjectMixin::has($this, $name);
145:     }
146: 
147: 
148: 
149:     public function __unset($name)
150:     {
151:         ObjectMixin::remove($this, $name);
152:     }
153: 
154: }
155: 
Nette Framework 2.0.4 API API documentation generated by ApiGen 2.7.0