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

Classes

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

Interfaces

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