Namespaces

  • Latte
    • Loaders
    • Macros
    • Runtime
  • Nette
    • Application
      • Responses
      • Routers
      • UI
    • Bridges
      • ApplicationDI
      • ApplicationLatte
      • ApplicationTracy
      • CacheDI
      • CacheLatte
      • DatabaseDI
      • DatabaseTracy
      • DITracy
      • FormsDI
      • FormsLatte
      • Framework
      • HttpDI
      • HttpTracy
      • MailDI
      • ReflectionDI
      • SecurityDI
      • SecurityTracy
    • Caching
      • Storages
    • ComponentModel
    • Database
      • Conventions
      • Drivers
      • Reflection
      • Table
    • DI
      • Config
        • Adapters
      • Extensions
    • Forms
      • Controls
      • Rendering
    • Http
    • Iterators
    • Loaders
    • Localization
    • Mail
    • Neon
    • PhpGenerator
    • Reflection
    • Security
    • Utils
  • none
  • Tracy
    • Bridges
      • Nette

Classes

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