Namespaces

  • Nette
    • Application
      • Diagnostics
      • Responses
      • Routers
      • UI
    • Caching
      • Storages
    • ComponentModel
    • Config
    • Database
      • Diagnostics
      • Drivers
      • Reflection
      • Table
    • DI
    • Diagnostics
    • Forms
      • Controls
      • Rendering
    • Http
    • Iterators
    • Latte
      • Macros
    • Loaders
    • Localization
    • Mail
    • Reflection
    • Security
    • Templating
    • Utils
  • NetteModule
  • None
  • PHP

Classes

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

Interfaces

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