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
  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 array $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 intr $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:     /**
 54:      * @return NCallback
 55:      */
 56:     public function toCallback()
 57:     {
 58:         return new NCallback($this->value);
 59:     }
 60: 
 61: 
 62: 
 63:     public function __toString()
 64:     {
 65:         return 'Function ' . $this->getName() . '()';
 66:     }
 67: 
 68: 
 69: 
 70:     public function getClosure()
 71:     {
 72:         return $this->isClosure() ? $this->value : NULL;
 73:     }
 74: 
 75: 
 76: 
 77:     /********************* Reflection layer ****************d*g**/
 78: 
 79: 
 80: 
 81:     /**
 82:      * @return NExtensionReflection
 83:      */
 84:     public function getExtension()
 85:     {
 86:         return ($name = $this->getExtensionName()) ? new NExtensionReflection($name) : NULL;
 87:     }
 88: 
 89: 
 90: 
 91:     public function getParameters()
 92:     {
 93:         foreach ($res = parent::getParameters() as $key => $val) {
 94:             $res[$key] = new NParameterReflection($this->value, $val->getName());
 95:         }
 96:         return $res;
 97:     }
 98: 
 99: 
100: 
101:     /********************* NObject behaviour ****************d*g**/
102: 
103: 
104: 
105:     /**
106:      * @return NClassReflection
107:      */
108:     public function getReflection()
109:     {
110:         return new NClassReflection($this);
111:     }
112: 
113: 
114: 
115:     public function __call($name, $args)
116:     {
117:         return NObjectMixin::call($this, $name, $args);
118:     }
119: 
120: 
121: 
122:     public function &__get($name)
123:     {
124:         return NObjectMixin::get($this, $name);
125:     }
126: 
127: 
128: 
129:     public function __set($name, $value)
130:     {
131:         return NObjectMixin::set($this, $name, $value);
132:     }
133: 
134: 
135: 
136:     public function __isset($name)
137:     {
138:         return NObjectMixin::has($this, $name);
139:     }
140: 
141: 
142: 
143:     public function __unset($name)
144:     {
145:         NObjectMixin::remove($this, $name);
146:     }
147: 
148: }
149: 
Nette Framework 2.0.1 (for PHP 5.2, prefixed) API API documentation generated by ApiGen 2.7.0