1 | <?php declare(strict_types = 1); |
||
13 | class PropertyGenerator extends AbstractGenerator |
||
14 | { |
||
15 | /** @var string Property name */ |
||
16 | protected $name; |
||
17 | |||
18 | /** @var string Property value */ |
||
19 | protected $value; |
||
20 | |||
21 | /** @var bool Flag that method is static */ |
||
22 | protected $isStatic = false; |
||
23 | |||
24 | /** @var string Method visibility */ |
||
25 | protected $visibility = ClassGenerator::VISIBILITY_PUBLIC; |
||
26 | |||
27 | /** |
||
28 | * PropertyGenerator constructor. |
||
29 | * |
||
30 | * @param string $name Property name |
||
31 | * @param mixed $value Property value |
||
32 | * @param AbstractGenerator|null $parent Parent generator |
||
33 | */ |
||
34 | public function __construct(string $name, $value = null, AbstractGenerator $parent = null) |
||
41 | |||
42 | /** |
||
43 | * Set protected property visibility. |
||
44 | * |
||
45 | * @return PropertyGenerator |
||
46 | */ |
||
47 | public function defProtected() : PropertyGenerator |
||
51 | |||
52 | /** |
||
53 | * Set property visibility. |
||
54 | * |
||
55 | * @param string $visibility Property visibility |
||
56 | * |
||
57 | * @return PropertyGenerator |
||
58 | */ |
||
59 | protected function defVisibility(string $visibility) : PropertyGenerator |
||
65 | |||
66 | /** |
||
67 | * Set private property visibility. |
||
68 | * |
||
69 | * @return PropertyGenerator |
||
70 | */ |
||
71 | public function defPrivate() : PropertyGenerator |
||
75 | |||
76 | /** |
||
77 | * Set method to be static. |
||
78 | * |
||
79 | * @return PropertyGenerator |
||
80 | */ |
||
81 | public function defStatic() : PropertyGenerator |
||
87 | |||
88 | /** |
||
89 | * {@inheritdoc} |
||
90 | * @throws \InvalidArgumentException |
||
91 | */ |
||
92 | public function defLine(string $code) |
||
96 | |||
97 | /** |
||
98 | * {@inheritdoc} |
||
99 | */ |
||
100 | public function code(int $indentation = 0) : string |
||
112 | } |
||
113 |