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 classes variable.
 17:  *
 18:  * @author     David Grudl
 19:  * @property-read NClassReflection $declaringClass
 20:  * @property-read IAnnotation[][] $annotations
 21:  * @property-read string $description
 22:  * @property-read string $name
 23:  * @property  mixed $value
 24:  * @property-read bool $public
 25:  * @property-read bool $private
 26:  * @property-read bool $protected
 27:  * @property-read bool $static
 28:  * @property-read bool $default
 29:  * @property-read int $modifiers
 30:  * @property-read string $docComment
 31:  * @property-write bool $accessible
 32:  * @package Nette\Reflection
 33:  */
 34: class NPropertyReflection extends ReflectionProperty
 35: {
 36: 
 37:     public function __toString()
 38:     {
 39:         return 'Property ' . parent::getDeclaringClass()->getName() . '::$' . $this->getName();
 40:     }
 41: 
 42: 
 43: 
 44:     /********************* Reflection layer ****************d*g**/
 45: 
 46: 
 47: 
 48:     /**
 49:      * @return NClassReflection
 50:      */
 51:     public function getDeclaringClass()
 52:     {
 53:         return new NClassReflection(parent::getDeclaringClass()->getName());
 54:     }
 55: 
 56: 
 57: 
 58:     /********************* NAnnotations support ****************d*g**/
 59: 
 60: 
 61: 
 62:     /**
 63:      * Has property specified annotation?
 64:      * @param  string
 65:      * @return bool
 66:      */
 67:     public function hasAnnotation($name)
 68:     {
 69:         $res = NAnnotationsParser::getAll($this);
 70:         return !empty($res[$name]);
 71:     }
 72: 
 73: 
 74: 
 75:     /**
 76:      * Returns an annotation value.
 77:      * @param  string
 78:      * @return IAnnotation
 79:      */
 80:     public function getAnnotation($name)
 81:     {
 82:         $res = NAnnotationsParser::getAll($this);
 83:         return isset($res[$name]) ? end($res[$name]) : NULL;
 84:     }
 85: 
 86: 
 87: 
 88:     /**
 89:      * Returns all annotations.
 90:      * @return IAnnotation[][]
 91:      */
 92:     public function getAnnotations()
 93:     {
 94:         return NAnnotationsParser::getAll($this);
 95:     }
 96: 
 97: 
 98: 
 99:     /**
100:      * Returns value of annotation 'description'.
101:      * @return string
102:      */
103:     public function getDescription()
104:     {
105:         return $this->getAnnotation('description');
106:     }
107: 
108: 
109: 
110:     /********************* NObject behaviour ****************d*g**/
111: 
112: 
113: 
114:     /**
115:      * @return NClassReflection
116:      */
117:     public function getReflection()
118:     {
119:         return new NClassReflection($this);
120:     }
121: 
122: 
123: 
124:     public function __call($name, $args)
125:     {
126:         return NObjectMixin::call($this, $name, $args);
127:     }
128: 
129: 
130: 
131:     public function &__get($name)
132:     {
133:         return NObjectMixin::get($this, $name);
134:     }
135: 
136: 
137: 
138:     public function __set($name, $value)
139:     {
140:         return NObjectMixin::set($this, $name, $value);
141:     }
142: 
143: 
144: 
145:     public function __isset($name)
146:     {
147:         return NObjectMixin::has($this, $name);
148:     }
149: 
150: 
151: 
152:     public function __unset($name)
153:     {
154:         NObjectMixin::remove($this, $name);
155:     }
156: 
157: }
158: 
Nette Framework 2.0.4 (for PHP 5.2, prefixed) API API documentation generated by ApiGen 2.7.0