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
      • Table
    • DI
      • Config
        • Adapters
      • Extensions
    • Forms
      • Controls
      • Rendering
    • Http
    • Iterators
    • Loaders
    • Localization
    • Mail
    • Neon
    • PhpGenerator
      • Traits
    • Reflection
    • Security
    • Tokenizer
    • Utils
  • Tracy
    • Bridges
      • Nette
  • none

Classes

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

Interfaces

  • IAnnotation
  • Overview
  • Namespace
  • Class
  • Tree
  • Deprecated
  • Other releases
 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: 
12: 
13: /**
14:  * Reports information about a classes variable.
15:  * @property-read ClassType $declaringClass
16:  * @property-read IAnnotation[][] $annotations
17:  * @property-read string $description
18:  * @property-read string $name
19:  * @property  mixed $value
20:  * @property-read bool $public
21:  * @property-read bool $private
22:  * @property-read bool $protected
23:  * @property-read bool $static
24:  * @property-read bool $default
25:  * @property-read int $modifiers
26:  * @property-read string $docComment
27:  * @property-write bool $accessible
28:  */
29: class Property extends \ReflectionProperty
30: {
31:     use Nette\SmartObject;
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: 
Nette 2.4-20180918 API API documentation generated by ApiGen 2.8.0