Skip to content
This repository was archived by the owner on Jul 1, 2019. It is now read-only.

Commit 36e1ca1

Browse files
author
Andrey Helldar
authored
Merge pull request #11 from andrey-helldar/analysis-XNx4kG
Apply fixes from StyleCI
2 parents b1d5be9 + c39380e commit 36e1ca1

File tree

8 files changed

+108
-108
lines changed

8 files changed

+108
-108
lines changed

phpunit.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
|
1212
*/
1313

14-
require __DIR__.'/vendor/autoload.php';
14+
require __DIR__ . '/vendor/autoload.php';
1515

1616
/*
1717
|--------------------------------------------------------------------------

src/DigitServiceProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,6 @@ protected function registerDigitText()
7070
*/
7171
public function provides()
7272
{
73-
return array('digittext', Facade::class);
73+
return ['digittext', Facade::class];
7474
}
7575
}

src/DigitText.php

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ public function text($digit = 0.0, $lang = 'en', $is_currency = false)
137137
$this->fraction();
138138

139139
$groups = str_split($this->digitReverse((int) $this->digit), 3);
140-
$result = array();
140+
$result = [];
141141
for ($i = sizeof($groups) - 1; $i >= 0; $i--) {
142142
if ((int) $groups[$i] > 0) {
143143
$result[] = $this->digits($groups[$i], $i);
@@ -164,7 +164,7 @@ private function fixDigit($digit = null)
164164
return;
165165
}
166166

167-
$digit = str_replace(array(',', '-', ' ', "'", '`'), '', (string) $digit);
167+
$digit = str_replace([',', '-', ' ', "'", '`'], '', (string) $digit);
168168

169169
if (strripos((string) $digit, '.') === false) {
170170
$this->digit = (float) $digit;
@@ -185,7 +185,7 @@ private function intl()
185185
{
186186
if ($this->is_currency) {
187187
if (extension_loaded('php_intl')) {
188-
return (new \MessageFormatter($this->lang, '{n, spellout}'))->format(array('n' => $this->digit));
188+
return (new \MessageFormatter($this->lang, '{n, spellout}'))->format(['n' => $this->digit]);
189189
}
190190
}
191191

@@ -248,11 +248,11 @@ private function digits($digit = 0.0, $id = 0)
248248
$digitUnsorted = (int) $this->digitReverse($digit);
249249

250250
$array = str_split((string) $digit, 1);
251-
$result = array();
251+
$result = [];
252252

253253
for ($i = sizeof($array) - 1; $i >= 0; $i--) {
254254
if ($i === 1 && $array[$i] == '1') {
255-
$d = $array[$i].$array[$i - 1];
255+
$d = $array[$i] . $array[$i - 1];
256256
$result[] = trim($this->texts[$id == 1 ? 3 : 0][(int) $d]);
257257
$i--;
258258
} elseif ((int) $array[$i] > 0) {
@@ -262,7 +262,7 @@ private function digits($digit = 0.0, $id = 0)
262262

263263
$result = implode(($this->lang == 'de' ? 'und' : ' '), $result);
264264

265-
return trim(trim($result).$this->decline($id, $digitUnsorted));
265+
return trim(trim($result) . $this->decline($id, $digitUnsorted));
266266
}
267267

268268
/**
@@ -282,20 +282,20 @@ private function decline($group = 0, $digit = 0.0)
282282

283283
switch ($group) {
284284
case 1:
285-
$result = $deleter.$this->texts['thousands'][0];
285+
$result = $deleter . $this->texts['thousands'][0];
286286
if ($text == 1) {
287-
$result = $deleter.$this->texts['thousands'][1];
287+
$result = $deleter . $this->texts['thousands'][1];
288288
} elseif ($text >= 2 && $text <= 4) {
289-
$result = $deleter.$this->texts['thousands'][2];
289+
$result = $deleter . $this->texts['thousands'][2];
290290
}
291291
break;
292292

293293
case 2:
294-
$result = $deleter.$this->texts['millions'][0];
294+
$result = $deleter . $this->texts['millions'][0];
295295
if ($text >= 2 && $text <= 4) {
296-
$result = $deleter.$this->texts['millions'][1];
296+
$result = $deleter . $this->texts['millions'][1];
297297
} elseif (($text >= 5 && $text <= 9) || $text == 0) {
298-
$result = $deleter.$this->texts['millions'][2];
298+
$result = $deleter . $this->texts['millions'][2];
299299
}
300300
break;
301301

@@ -320,18 +320,18 @@ private function getCurrency($content = null)
320320
}
321321

322322
if ($this->texts['currency']['position'] == 'before') {
323-
$result = $this->texts['currency']['int'].' '.$content;
323+
$result = $this->texts['currency']['int'] . ' ' . $content;
324324

325325
if ($this->surplus > 0) {
326-
$result .= '.'.$this->surplus;
326+
$result .= '.' . $this->surplus;
327327
}
328328
} else {
329-
$result = trim($content).' '.$this->texts['currency']['int'];
329+
$result = trim($content) . ' ' . $this->texts['currency']['int'];
330330

331331
if ($this->surplus > 0) {
332-
$result .= ' '.$this->surplus.' '.$this->texts['currency']['fraction'];
332+
$result .= ' ' . $this->surplus . ' ' . $this->texts['currency']['fraction'];
333333
} else {
334-
$result .= ' 00 '.$this->texts['currency']['fraction'];
334+
$result .= ' 00 ' . $this->texts['currency']['fraction'];
335335
}
336336
}
337337

src/lang/de.php

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
* THE SOFTWARE.
2424
*/
2525

26-
return array(
27-
0 => array(
26+
return [
27+
0 => [
2828
0 => '',
2929
1 => 'ein',
3030
2 => 'zwei',
@@ -45,9 +45,9 @@
4545
17 => 'siebzehn',
4646
18 => 'achtzehn',
4747
19 => 'neunzehn',
48-
),
48+
],
4949

50-
1 => array(
50+
1 => [
5151
2 => 'zwanzig',
5252
3 => 'dreißig',
5353
4 => 'vierzig',
@@ -56,9 +56,9 @@
5656
7 => 'siebzig',
5757
8 => 'achtzig',
5858
9 => 'neunzig',
59-
),
59+
],
6060

61-
2 => array(
61+
2 => [
6262
0 => '',
6363
1 => 'hundert',
6464
2 => 'zweihundert',
@@ -69,9 +69,9 @@
6969
7 => 'siebenhundert',
7070
8 => 'achthundert',
7171
9 => 'neunhundert',
72-
),
72+
],
7373

74-
3 => array(
74+
3 => [
7575
0 => '',
7676
1 => 'einer',
7777
2 => 'zwei',
@@ -92,9 +92,9 @@
9292
17 => 'siebzehn',
9393
18 => 'achtzehn',
9494
19 => 'neunzehn',
95-
),
95+
],
9696

97-
4 => array(
97+
4 => [
9898
0 => '',
9999
2 => 'zwanzig',
100100
3 => 'dreißig',
@@ -104,9 +104,9 @@
104104
7 => 'siebzig',
105105
8 => 'achtzig',
106106
9 => 'neunzig',
107-
),
107+
],
108108

109-
5 => array(
109+
5 => [
110110
0 => '',
111111
1 => 'hundert',
112112
2 => 'zweihundert',
@@ -117,25 +117,25 @@
117117
7 => 'siebenhundert',
118118
8 => 'achthundert',
119119
9 => 'neunhundert',
120-
),
120+
],
121121

122-
'currency' => array(
122+
'currency' => [
123123
'int' => 'Mark',
124124
'fraction' => 'cent',
125125
'position' => 'after',
126-
),
126+
],
127127

128128
'zero' => 'null',
129129

130-
'thousands' => array(
130+
'thousands' => [
131131
0 => 'tausende',
132132
1 => 'tausend',
133133
2 => 'tausende',
134-
),
134+
],
135135

136-
'millions' => array(
136+
'millions' => [
137137
0 => 'million',
138138
1 => 'million',
139139
2 => 'million',
140-
),
141-
);
140+
],
141+
];

src/lang/en.php

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
* THE SOFTWARE.
2424
*/
2525

26-
return array(
27-
0 => array(
26+
return [
27+
0 => [
2828
0 => '',
2929
1 => 'one',
3030
2 => 'two',
@@ -45,9 +45,9 @@
4545
17 => 'seventeen',
4646
18 => 'eighteen',
4747
19 => 'nineteen',
48-
),
48+
],
4949

50-
1 => array(
50+
1 => [
5151
2 => 'twenty',
5252
3 => 'thirty',
5353
4 => 'forty',
@@ -56,9 +56,9 @@
5656
7 => 'seventy',
5757
8 => 'eighty',
5858
9 => 'ninety',
59-
),
59+
],
6060

61-
2 => array(
61+
2 => [
6262
0 => '',
6363
1 => 'one hundred',
6464
2 => 'two hundred',
@@ -69,9 +69,9 @@
6969
7 => 'seven hundred',
7070
8 => 'eight hundred',
7171
9 => 'nine hundred',
72-
),
72+
],
7373

74-
3 => array(
74+
3 => [
7575
0 => '',
7676
1 => 'one',
7777
2 => 'two',
@@ -92,9 +92,9 @@
9292
17 => 'seventeen',
9393
18 => 'eighteen',
9494
19 => 'nineteen',
95-
),
95+
],
9696

97-
4 => array(
97+
4 => [
9898
0 => '',
9999
2 => 'twenty',
100100
3 => 'thirty',
@@ -104,9 +104,9 @@
104104
7 => 'seventy',
105105
8 => 'eighty',
106106
9 => 'ninety',
107-
),
107+
],
108108

109-
5 => array(
109+
5 => [
110110
0 => '',
111111
1 => 'one hundred',
112112
2 => 'two hundred',
@@ -117,25 +117,25 @@
117117
7 => 'seven hundred',
118118
8 => 'eight hundred',
119119
9 => 'nine hundred',
120-
),
120+
],
121121

122-
'currency' => array(
122+
'currency' => [
123123
'int' => 'dollars',
124124
'fraction' => 'cents',
125125
'position' => 'after',
126-
),
126+
],
127127

128128
'zero' => 'zero',
129129

130-
'thousands' => array(
130+
'thousands' => [
131131
0 => 'thousands',
132132
1 => 'thousand',
133133
2 => 'thousands',
134-
),
134+
],
135135

136-
'millions' => array(
136+
'millions' => [
137137
0 => 'million',
138138
1 => 'million',
139139
2 => 'million',
140-
),
141-
);
140+
],
141+
];

0 commit comments

Comments
 (0)