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
  • PHP

Classes

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

Interfaces

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