Namespaces

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

Classes

  • ClassType
  • Helpers
  • Method
  • Parameter
  • PhpLiteral
  • Property
  • 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 (http://davidgrudl.com)
 6:  */
 7: 
 8: namespace Nette\PhpGenerator;
 9: 
10: use Nette;
11: 
12: 
13: /**
14:  * Class property description.
15:  *
16:  * @author     David Grudl
17:  *
18:  * @method Property setName(string)
19:  * @method string getName()
20:  * @method Property setValue(mixed)
21:  * @method mixed getValue()
22:  * @method Property setStatic(bool)
23:  * @method bool isStatic()
24:  * @method Property setVisibility(string)
25:  * @method string getVisibility()
26:  * @method Property setDocuments(string[])
27:  * @method string[] getDocuments()
28:  * @method Property addDocument(string)
29:  */
30: class Property extends Nette\Object
31: {
32:     /** @var string */
33:     private $name;
34: 
35:     /** @var mixed */
36:     public $value;
37: 
38:     /** @var bool */
39:     private $static;
40: 
41:     /** @var string  public|protected|private */
42:     private $visibility = 'public';
43: 
44:     /** @var array of string */
45:     private $documents = array();
46: 
47: 
48:     /** @return Property */
49:     public static function from(\ReflectionProperty $from)
50:     {
51:         $prop = new static;
52:         $prop->name = $from->getName();
53:         $defaults = $from->getDeclaringClass()->getDefaultProperties();
54:         $prop->value = isset($defaults[$from->name]) ? $defaults[$from->name] : NULL;
55:         $prop->static = $from->isStatic();
56:         $prop->visibility = $from->isPrivate() ? 'private' : ($from->isProtected() ? 'protected' : 'public');
57:         $prop->documents = preg_replace('#^\s*\* ?#m', '', trim($from->getDocComment(), "/* \r\n\t"));
58:         return $prop;
59:     }
60: 
61: }
62: 
Nette 2.2 API documentation generated by ApiGen 2.8.0