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

Classes

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

Interfaces

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