@@ -56,7 +56,7 @@ class DigitText
56
56
*
57
57
* @return null|string
58
58
*/
59
- public function get ($ digit = 0.0 , string $ lang = 'en ' , bool $ is_currency = false )
59
+ public function get ($ digit = 0.0 , string $ lang = 'en ' , bool $ is_currency = false ): ? string
60
60
{
61
61
$ this ->setLang ($ lang );
62
62
$ this ->setCurrency ($ is_currency );
@@ -99,7 +99,7 @@ private function setCurrency(bool $is_currency = false)
99
99
/**
100
100
* @return string
101
101
*/
102
- private function getResult ()
102
+ private function getResult (): string
103
103
{
104
104
$ result = $ this ->getFractional ();
105
105
$ divider = $ this ->lang === 'de ' ? 'und ' : ' ' ;
@@ -118,7 +118,7 @@ private function getResult()
118
118
*
119
119
* @return array
120
120
*/
121
- private function getFractional ()
121
+ private function getFractional (): array
122
122
{
123
123
$ this ->fraction ();
124
124
@@ -164,7 +164,7 @@ private function fixDigit($digit = null)
164
164
*
165
165
* @return null|string
166
166
*/
167
- private function intl ()
167
+ private function intl (): ? string
168
168
{
169
169
if ($ this ->is_currency && extension_loaded ('php_intl ' )) {
170
170
return (new \MessageFormatter ($ this ->lang , '{n, spellout} ' ))
@@ -208,7 +208,7 @@ private function fraction()
208
208
*
209
209
* @return string
210
210
*/
211
- private function digitReverse ($ digit = '0 ' )
211
+ private function digitReverse ($ digit = '0 ' ): string
212
212
{
213
213
return strrev ((string ) $ digit );
214
214
}
@@ -221,7 +221,7 @@ private function digitReverse($digit = '0')
221
221
*
222
222
* @return string
223
223
*/
224
- private function digits ($ digit = 0.0 , $ id = 0 )
224
+ private function digits ($ digit = 0.0 , $ id = 0 ): string
225
225
{
226
226
if ($ digit == 0 ) {
227
227
return $ this ->texts ['zero ' ];
@@ -238,7 +238,7 @@ private function digits($digit = 0.0, $id = 0)
238
238
*
239
239
* @return string
240
240
*/
241
- private function compactDigits ($ digit = 0.0 , $ id = 0 )
241
+ private function compactDigits ($ digit = 0.0 , $ id = 0 ): string
242
242
{
243
243
$ array = str_split ((string ) $ digit , 1 );
244
244
$ result = [];
@@ -268,7 +268,7 @@ private function compactDigits($digit = 0.0, $id = 0)
268
268
*
269
269
* @return string
270
270
*/
271
- private function decline ($ group = 0 , $ digit = 0.0 )
271
+ private function decline ($ group = 0 , $ digit = 0.0 ): string
272
272
{
273
273
$ text = (string ) ((int ) $ digit );
274
274
$ text = (int ) $ text [strlen ($ digit ) - 1 ];
@@ -308,9 +308,9 @@ private function decline($group = 0, $digit = 0.0)
308
308
*
309
309
* @return string
310
310
*/
311
- private function getCurrency (string $ content = null )
311
+ private function getCurrency (string $ content = null ): string
312
312
{
313
- if (empty ( $ content) ) {
313
+ if (! $ content ) {
314
314
return '--- ' ;
315
315
}
316
316
@@ -327,10 +327,6 @@ private function getCurrency(string $content = null)
327
327
$ result = implode (' ' , [
328
328
trim ($ content ),
329
329
$ this ->texts ['currency ' ]['int ' ],
330
- ]);
331
-
332
- $ result .= implode (' ' , [
333
- '' ,
334
330
str_pad ((string ) $ this ->surplus , $ this ->texts ['currency ' ]['precision ' ], '0 ' , STR_PAD_RIGHT ),
335
331
$ this ->texts ['currency ' ]['fraction ' ],
336
332
]);
0 commit comments