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