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 array $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 intr $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:     public function getParameters()
 95:     {
 96:         foreach ($res = parent::getParameters() as $key => $val) {
 97:             $res[$key] = new Parameter($this->value, $val->getName());
 98:         }
 99:         return $res;
100:     }
101: 
102: 
103: 
104:     /********************* Nette\Object behaviour ****************d*g**/
105: 
106: 
107: 
108:     /**
109:      * @return ClassType
110:      */
111:     public static function getReflection()
112:     {
113:         return new ClassType(get_called_class());
114:     }
115: 
116: 
117: 
118:     public function __call($name, $args)
119:     {
120:         return ObjectMixin::call($this, $name, $args);
121:     }
122: 
123: 
124: 
125:     public function &__get($name)
126:     {
127:         return ObjectMixin::get($this, $name);
128:     }
129: 
130: 
131: 
132:     public function __set($name, $value)
133:     {
134:         return ObjectMixin::set($this, $name, $value);
135:     }
136: 
137: 
138: 
139:     public function __isset($name)
140:     {
141:         return ObjectMixin::has($this, $name);
142:     }
143: 
144: 
145: 
146:     public function __unset($name)
147:     {
148:         ObjectMixin::remove($this, $name);
149:     }
150: 
151: }
152: 
Nette Framework 2.0.3 API API documentation generated by ApiGen 2.7.0