1 | <?php |
||
19 | class Message |
||
20 | { |
||
21 | /** |
||
22 | * @var string |
||
23 | * |
||
24 | * The domain the message belongs to |
||
25 | */ |
||
26 | private $domain; |
||
27 | |||
28 | /** |
||
29 | * @var string |
||
30 | * |
||
31 | * The key/phrase you write in the source code |
||
32 | */ |
||
33 | private $key; |
||
34 | |||
35 | /** |
||
36 | * @var string |
||
37 | * |
||
38 | * The locale the translations is on |
||
39 | */ |
||
40 | private $locale; |
||
41 | |||
42 | /** |
||
43 | * @var string |
||
44 | * |
||
45 | * The translated string. This is the preview of the message. Ie no placeholders is visible. |
||
46 | */ |
||
47 | private $translation; |
||
48 | |||
49 | /** |
||
50 | * Key value array with metadata. |
||
51 | * |
||
52 | * @var array |
||
53 | */ |
||
54 | private $meta = []; |
||
55 | |||
56 | /** |
||
57 | * @param string $key |
||
58 | * @param string $domain |
||
59 | * @param string $locale |
||
60 | * @param string $translation |
||
61 | * @param array $meta |
||
62 | */ |
||
63 | public function __construct($key = '', $domain = '', $locale = '', $translation = '', array $meta = []) |
||
71 | |||
72 | /** |
||
73 | * @return string |
||
74 | */ |
||
75 | public function getDomain() |
||
79 | |||
80 | /** |
||
81 | * @param string $domain |
||
82 | * |
||
83 | * @return Message |
||
84 | */ |
||
85 | public function setDomain($domain) |
||
91 | |||
92 | /** |
||
93 | * @return string |
||
94 | */ |
||
95 | public function getKey() |
||
96 | { |
||
97 | return $this->key; |
||
98 | } |
||
99 | |||
100 | /** |
||
101 | * @param string $key |
||
102 | * |
||
103 | * @return Message |
||
104 | */ |
||
105 | public function setKey($key) |
||
106 | { |
||
107 | $this->key = $key; |
||
108 | |||
109 | return $this; |
||
110 | } |
||
111 | |||
112 | /** |
||
113 | * @return string |
||
114 | */ |
||
115 | public function getLocale() |
||
119 | |||
120 | /** |
||
121 | * @param string $locale |
||
122 | * |
||
123 | * @return Message |
||
124 | */ |
||
125 | public function setLocale($locale) |
||
131 | |||
132 | /** |
||
133 | * @return string |
||
134 | */ |
||
135 | public function getTranslation() |
||
139 | |||
140 | /** |
||
141 | * @param string $translation |
||
142 | * |
||
143 | * @return Message |
||
144 | */ |
||
145 | public function setTranslation($translation) |
||
151 | |||
152 | /** |
||
153 | * @return array |
||
154 | */ |
||
155 | public function getAllMeta() |
||
159 | |||
160 | /** |
||
161 | * @param array $meta |
||
162 | * |
||
163 | * @return Message |
||
164 | */ |
||
165 | public function setMeta(array $meta) |
||
171 | |||
172 | /** |
||
173 | * @param array $meta |
||
|
|||
174 | * |
||
175 | * @return Message |
||
176 | */ |
||
177 | public function addMeta($key, $value) |
||
183 | |||
184 | /** |
||
185 | * @param string $key |
||
186 | * |
||
187 | * @return mixed|null |
||
188 | */ |
||
189 | public function getMeta($key) |
||
197 | } |
||
198 |
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.