Packages

  • Nette
    • Application
    • Caching
    • Collections
    • Config
    • Forms
    • IO
    • Loaders
    • Mail
    • Reflection
    • Security
    • Templates
    • Web
  • None
  • PHP

Classes

  • NAnnotation
  • NAnnotationsParser
  • NClassReflection
  • NExtensionReflection
  • NFunctionReflection
  • NMethodReflection
  • NParameterReflection
  • NPropertyReflection

Interfaces

  • IAnnotation
  • Overview
  • Package
  • Class
  • Tree
  • Other releases
  1: <?php
  2: 
  3: /**
  4:  * This file is part of the Nette Framework (https://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:  * @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 NPropertyReflection 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 NClassReflection
 37:      */
 38:     public function getDeclaringClass()
 39:     {
 40:         return new NClassReflection(parent::getDeclaringClass()->getName());
 41:     }
 42: 
 43: 
 44: 
 45:     /********************* NAnnotations 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 = NAnnotationsParser::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 = NAnnotationsParser::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 NAnnotationsParser::getAll($this);
 82:     }
 83: 
 84: 
 85: 
 86:     /********************* NObject behaviour ****************d*g**/
 87: 
 88: 
 89: 
 90:     /**
 91:      * @return NClassReflection
 92:      */
 93:     public function getReflection()
 94:     {
 95:         return new NClassReflection($this);
 96:     }
 97: 
 98: 
 99: 
100:     public function __call($name, $args)
101:     {
102:         return NObjectMixin::call($this, $name, $args);
103:     }
104: 
105: 
106: 
107:     public function &__get($name)
108:     {
109:         return NObjectMixin::get($this, $name);
110:     }
111: 
112: 
113: 
114:     public function __set($name, $value)
115:     {
116:         return NObjectMixin::set($this, $name, $value);
117:     }
118: 
119: 
120: 
121:     public function __isset($name)
122:     {
123:         return NObjectMixin::has($this, $name);
124:     }
125: 
126: 
127: 
128:     public function __unset($name)
129:     {
130:         throw new MemberAccessException("Cannot unset the property {$this->reflection->name}::\$$name.");
131:     }
132: 
133: }
134: 
Nette Framework 0.9.7 (for PHP 5.2) API documentation generated by ApiGen 2.3.0