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

  • Annotation
  • AnnotationsParser
  • ClassReflection
  • ExtensionReflection
  • FunctionReflection
  • MethodReflection
  • ParameterReflection
  • PropertyReflection

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 method's parameter.
 17:  *
 18:  * @author     David Grudl
 19:  * @property-read ClassReflection $class
 20:  * @property-read string $className
 21:  * @property-read ClassReflection $declaringClass
 22:  * @property-read MethodReflection $declaringFunction
 23:  * @property-read string $name
 24:  * @property-read bool $passedByReference
 25:  * @property-read bool $array
 26:  * @property-read int $position
 27:  * @property-read bool $optional
 28:  * @property-read bool $defaultValueAvailable
 29:  * @property-read mixed $defaultValue
 30:  * @package Nette\Reflection
 31:  */
 32: class ParameterReflection extends ReflectionParameter
 33: {
 34:     /** @var mixed */
 35:     private $function;
 36: 
 37: 
 38:     public function __construct($function, $parameter)
 39:     {
 40:         parent::__construct($this->function = $function, $parameter);
 41:     }
 42: 
 43: 
 44: 
 45:     /**
 46:      * @return ClassReflection
 47:      */
 48:     public function getClass()
 49:     {
 50:         return ($ref = parent::getClass()) ? new ClassReflection($ref->getName()) : NULL;
 51:     }
 52: 
 53: 
 54: 
 55:     /**
 56:      * @return string
 57:      */
 58:     public function getClassName()
 59:     {
 60:         try {
 61:             return ($ref = parent::getClass()) ? $ref->getName() : NULL;
 62:         } catch (ReflectionException $e) {
 63:             if (preg_match('#Class (.+) does not exist#', $e->getMessage(), $m)) {
 64:                 return $m[1];
 65:             }
 66:             throw $e;
 67:         }
 68:     }
 69: 
 70: 
 71: 
 72:     /**
 73:      * @return ClassReflection
 74:      */
 75:     public function getDeclaringClass()
 76:     {
 77:         return ($ref = parent::getDeclaringClass()) ? new ClassReflection($ref->getName()) : NULL;
 78:     }
 79: 
 80: 
 81: 
 82:     /**
 83:      * @return MethodReflection | FunctionReflection
 84:      */
 85:     public function getDeclaringFunction()
 86:     {
 87:         return is_array($this->function)
 88:             ? new MethodReflection($this->function[0], $this->function[1])
 89:             : new FunctionReflection($this->function);
 90:     }
 91: 
 92: 
 93: 
 94:     public function __toString()
 95:     {
 96:         return 'Parameter $' . parent::getName() . ' in ' . $this->getDeclaringFunction();
 97:     }
 98: 
 99: 
100: 
101:     /********************* Object behaviour ****************d*g**/
102: 
103: 
104: 
105:     /**
106:      * @return ClassReflection
107:      */
108:     public function getReflection()
109:     {
110:         return new ClassReflection($this);
111:     }
112: 
113: 
114: 
115:     public function __call($name, $args)
116:     {
117:         return ObjectMixin::call($this, $name, $args);
118:     }
119: 
120: 
121: 
122:     public function &__get($name)
123:     {
124:         return ObjectMixin::get($this, $name);
125:     }
126: 
127: 
128: 
129:     public function __set($name, $value)
130:     {
131:         return ObjectMixin::set($this, $name, $value);
132:     }
133: 
134: 
135: 
136:     public function __isset($name)
137:     {
138:         return ObjectMixin::has($this, $name);
139:     }
140: 
141: 
142: 
143:     public function __unset($name)
144:     {
145:         ObjectMixin::remove($this, $name);
146:     }
147: 
148: }
149: 
Nette Framework 2.0.1 (for PHP 5.2, un-prefixed) API API documentation generated by ApiGen 2.7.0