1 | <?php |
||
7 | class Name |
||
8 | { |
||
9 | private const PARTS_NAMESPACE = 'TheIconic\NameParser\Part'; |
||
10 | |||
11 | /** |
||
12 | * @var array the parts that make up this name |
||
13 | */ |
||
14 | protected $parts = []; |
||
15 | |||
16 | /** |
||
17 | * constructor takes the array of parts this name consists of |
||
18 | * |
||
19 | * @param array|null $parts |
||
20 | */ |
||
21 | public function __construct(array $parts = null) |
||
27 | |||
28 | /** |
||
29 | * @return string |
||
30 | */ |
||
31 | public function __toString(): string |
||
35 | |||
36 | /** |
||
37 | * set the parts this name consists of |
||
38 | * |
||
39 | * @param array $parts |
||
40 | * @return $this |
||
41 | */ |
||
42 | public function setParts(array $parts): Name |
||
48 | |||
49 | /** |
||
50 | * get the parts this name consists of |
||
51 | * |
||
52 | * @return array |
||
53 | */ |
||
54 | public function getParts(): array |
||
58 | |||
59 | /** |
||
60 | * @param bool $format |
||
61 | * @return array |
||
62 | */ |
||
63 | public function getAll(bool $format = false): array |
||
85 | |||
86 | /** |
||
87 | * get the first name |
||
88 | * |
||
89 | * @return string |
||
90 | */ |
||
91 | public function getFirstname(): string |
||
95 | |||
96 | /** |
||
97 | * get the last name |
||
98 | * |
||
99 | * @param bool $pure |
||
100 | * @return string |
||
101 | */ |
||
102 | public function getLastname(bool $pure = false): string |
||
106 | |||
107 | /** |
||
108 | * get the last name prefix |
||
109 | * |
||
110 | * @return string |
||
111 | */ |
||
112 | public function getLastnamePrefix(): string |
||
116 | |||
117 | /** |
||
118 | * get the initials |
||
119 | * |
||
120 | * @return string |
||
121 | */ |
||
122 | public function getInitials(): string |
||
126 | |||
127 | /** |
||
128 | * get the suffix(es) |
||
129 | * |
||
130 | * @return string |
||
131 | */ |
||
132 | public function getSuffix(): string |
||
136 | |||
137 | /** |
||
138 | * get the salutation(s) |
||
139 | * |
||
140 | * @return string |
||
141 | */ |
||
142 | public function getSalutation(): string |
||
146 | |||
147 | /** |
||
148 | * get the nick name(s) |
||
149 | * |
||
150 | * @param bool $wrap |
||
151 | * @return string |
||
152 | */ |
||
153 | public function getNickname(bool $wrap = false): string |
||
161 | |||
162 | /** |
||
163 | * get the middle name(s) |
||
164 | * |
||
165 | * @return string |
||
166 | */ |
||
167 | public function getMiddlename(): string |
||
171 | |||
172 | /** |
||
173 | * helper method used by getters to extract and format relevant name parts |
||
174 | * |
||
175 | * @param string $type |
||
176 | * @param bool $pure |
||
|
|||
177 | * @return string |
||
178 | */ |
||
179 | protected function export(string $type, bool $strict = false): string |
||
191 | |||
192 | /** |
||
193 | * helper method to check if a part is of the given type |
||
194 | * |
||
195 | * @param AbstractPart $part |
||
196 | * @param string $type |
||
197 | * @param bool $strict |
||
198 | * @return bool |
||
199 | */ |
||
200 | protected function isType(AbstractPart $part, string $type, bool $strict = false): bool |
||
210 | } |
||
211 |
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.
Consider the following example. The parameter
$italy
is not defined by the methodfinale(...)
.The most likely cause is that the parameter was removed, but the annotation was not.