Packages

  • 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

  • NAnnotation
  • NAnnotationsParser
  • NClassReflection
  • NExtensionReflection
  • NFunctionReflection
  • NMethodReflection
  • NParameterReflection
  • NPropertyReflection

Interfaces

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