1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
/* |
6
|
|
|
* This file is part of the Micro framework package. |
7
|
|
|
* |
8
|
|
|
* (c) Stanislau Komar <[email protected]> |
9
|
|
|
* |
10
|
|
|
* For the full copyright and license information, please view the LICENSE |
11
|
|
|
* file that was distributed with this source code. |
12
|
|
|
*/ |
13
|
|
|
|
14
|
|
|
namespace Micro\Library\DTO\ClassDef; |
15
|
|
|
|
16
|
|
|
class MethodDefinition |
17
|
|
|
{ |
18
|
|
|
private string $visibility = 'public'; |
19
|
|
|
|
20
|
|
|
private string $name = ''; |
21
|
|
|
/** |
22
|
|
|
* @var string[] |
23
|
|
|
*/ |
24
|
|
|
private array $typesReturn = []; |
25
|
|
|
/** |
26
|
|
|
* @var PropertyDefinition[] |
27
|
|
|
*/ |
28
|
|
|
private array $args = []; |
29
|
|
|
|
30
|
|
|
private string $body = ''; |
31
|
|
|
/** |
32
|
|
|
* @var string[] |
33
|
|
|
*/ |
34
|
|
|
private array $comments = []; |
35
|
|
|
private bool $isStatic = false; |
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* @return string |
39
|
|
|
*/ |
40
|
1 |
|
public function getVisibility(): string |
41
|
|
|
{ |
42
|
1 |
|
return $this->visibility; |
43
|
|
|
} |
44
|
|
|
|
45
|
|
|
/** |
46
|
|
|
* @param string $visibility |
47
|
|
|
*/ |
48
|
1 |
|
public function setVisibility(string $visibility): void |
49
|
|
|
{ |
50
|
1 |
|
$this->visibility = $visibility; |
51
|
|
|
} |
52
|
|
|
|
53
|
|
|
/** |
54
|
|
|
* @return string |
55
|
|
|
*/ |
56
|
1 |
|
public function getName(): string |
57
|
|
|
{ |
58
|
1 |
|
return $this->name; |
59
|
|
|
} |
60
|
|
|
|
61
|
|
|
/** |
62
|
|
|
* @param string $name |
63
|
|
|
*/ |
64
|
1 |
|
public function setName(string $name): void |
65
|
|
|
{ |
66
|
1 |
|
$this->name = $name; |
67
|
|
|
} |
68
|
|
|
|
69
|
|
|
/** |
70
|
|
|
* @return string[] |
71
|
|
|
*/ |
72
|
1 |
|
public function getTypesReturn(): array |
73
|
|
|
{ |
74
|
1 |
|
return $this->typesReturn; |
75
|
|
|
} |
76
|
|
|
|
77
|
|
|
/** |
78
|
|
|
* @param array<string> $typesReturn |
79
|
|
|
*/ |
80
|
1 |
|
public function setTypesReturn(array $typesReturn): void |
81
|
|
|
{ |
82
|
1 |
|
$this->typesReturn = $typesReturn; |
83
|
|
|
} |
84
|
|
|
|
85
|
|
|
/** |
86
|
|
|
* @return PropertyDefinition[] |
87
|
|
|
*/ |
88
|
1 |
|
public function getArgs(): array |
89
|
|
|
{ |
90
|
1 |
|
return $this->args; |
91
|
|
|
} |
92
|
|
|
|
93
|
|
|
/** |
94
|
|
|
* @param PropertyDefinition[] $args |
95
|
|
|
*/ |
96
|
1 |
|
public function setArgs(array $args): void |
97
|
|
|
{ |
98
|
1 |
|
$this->args = $args; |
99
|
|
|
} |
100
|
|
|
|
101
|
|
|
/** |
102
|
|
|
* @return string |
103
|
|
|
*/ |
104
|
1 |
|
public function getBody(): string |
105
|
|
|
{ |
106
|
1 |
|
return $this->body; |
107
|
|
|
} |
108
|
|
|
|
109
|
|
|
/** |
110
|
|
|
* @param string $body |
111
|
|
|
*/ |
112
|
1 |
|
public function setBody(string $body): void |
113
|
|
|
{ |
114
|
1 |
|
$this->body = $body; |
115
|
|
|
} |
116
|
|
|
|
117
|
|
|
/** |
118
|
|
|
* @return array<string> |
119
|
|
|
*/ |
120
|
1 |
|
public function getComments(): array |
121
|
|
|
{ |
122
|
1 |
|
return $this->comments; |
123
|
|
|
} |
124
|
|
|
|
125
|
|
|
/** |
126
|
|
|
* @return bool |
127
|
|
|
*/ |
128
|
1 |
|
public function isStatic(): bool |
129
|
|
|
{ |
130
|
1 |
|
return $this->isStatic; |
131
|
|
|
} |
132
|
|
|
|
133
|
|
|
/** |
134
|
|
|
* @param bool $isStatic |
135
|
|
|
*/ |
136
|
1 |
|
public function setIsStatic(bool $isStatic): void |
137
|
|
|
{ |
138
|
1 |
|
$this->isStatic = $isStatic; |
139
|
|
|
} |
140
|
|
|
} |
141
|
|
|
|