Packages

  • Nette
    • Application
      • Application\Diagnostics
      • Application\Responses
      • Application\Routers
      • Application\UI
    • Caching
      • Caching\Storages
    • ComponentModel
    • Config
    • Database
      • Database\Diagnostics
      • Database\Drivers
      • Database\Reflection
      • Database\Table
    • DI
    • Diagnostics
    • Forms
      • Forms\Controls
      • Forms\Rendering
    • Http
    • Iterators
    • Latte
      • Latte\Macros
    • Loaders
    • Localization
    • Mail
    • Reflection
    • Security
    • Templating
    • Utils
  • 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, 2011 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:  * @package Nette\Reflection
 20:  */
 21: class PropertyReflection extends ReflectionProperty
 22: {
 23: 
 24:     public function __toString()
 25:     {
 26:         return 'Property ' . parent::getDeclaringClass()->getName() . '::$' . $this->getName();
 27:     }
 28: 
 29: 
 30: 
 31:     /********************* Reflection layer ****************d*g**/
 32: 
 33: 
 34: 
 35:     /**
 36:      * @return ClassReflection
 37:      */
 38:     public function getDeclaringClass()
 39:     {
 40:         return new ClassReflection(parent::getDeclaringClass()->getName());
 41:     }
 42: 
 43: 
 44: 
 45:     /********************* Annotations support ****************d*g**/
 46: 
 47: 
 48: 
 49:     /**
 50:      * Has property specified annotation?
 51:      * @param  string
 52:      * @return bool
 53:      */
 54:     public function hasAnnotation($name)
 55:     {
 56:         $res = AnnotationsParser::getAll($this);
 57:         return !empty($res[$name]);
 58:     }
 59: 
 60: 
 61: 
 62:     /**
 63:      * Returns an annotation value.
 64:      * @param  string
 65:      * @return IAnnotation
 66:      */
 67:     public function getAnnotation($name)
 68:     {
 69:         $res = AnnotationsParser::getAll($this);
 70:         return isset($res[$name]) ? end($res[$name]) : NULL;
 71:     }
 72: 
 73: 
 74: 
 75:     /**
 76:      * Returns all annotations.
 77:      * @return array
 78:      */
 79:     public function getAnnotations()
 80:     {
 81:         return AnnotationsParser::getAll($this);
 82:     }
 83: 
 84: 
 85: 
 86:     /**
 87:      * Returns value of annotation 'description'.
 88:      * @return string
 89:      */
 90:     public function getDescription()
 91:     {
 92:         return $this->getAnnotation('description');
 93:     }
 94: 
 95: 
 96: 
 97:     /********************* Object behaviour ****************d*g**/
 98: 
 99: 
100: 
101:     /**
102:      * @return ClassReflection
103:      */
104:     public function getReflection()
105:     {
106:         return new ClassReflection($this);
107:     }
108: 
109: 
110: 
111:     public function __call($name, $args)
112:     {
113:         return ObjectMixin::call($this, $name, $args);
114:     }
115: 
116: 
117: 
118:     public function &__get($name)
119:     {
120:         return ObjectMixin::get($this, $name);
121:     }
122: 
123: 
124: 
125:     public function __set($name, $value)
126:     {
127:         return ObjectMixin::set($this, $name, $value);
128:     }
129: 
130: 
131: 
132:     public function __isset($name)
133:     {
134:         return ObjectMixin::has($this, $name);
135:     }
136: 
137: 
138: 
139:     public function __unset($name)
140:     {
141:         ObjectMixin::remove($this, $name);
142:     }
143: 
144: }
145: 
Nette Framework 2.0beta1 (for PHP 5.2) API API documentation generated by ApiGen 2.3.0