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

Commit af640d8

Browse files
author
Andrey Helldar
committed
Optimize precission value
1 parent 6610ee2 commit af640d8

File tree

5 files changed

+15
-17
lines changed

5 files changed

+15
-17
lines changed

src/DigitText.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ class DigitText
3535
*/
3636
private $surplus = 0;
3737

38+
private $precision = 2;
39+
3840
/**
3941
* @var bool
4042
*/
@@ -326,7 +328,7 @@ private function getCurrency(string $content = null): string
326328
$result = implode(' ', [
327329
trim($content),
328330
$this->texts['currency']['int'],
329-
str_pad((string) $this->surplus, $this->texts['currency']['precision'], '0', STR_PAD_RIGHT),
331+
str_pad((string) $this->surplus, $this->precision, '0', STR_PAD_RIGHT),
330332
$this->texts['currency']['fraction'],
331333
]);
332334
}

src/lang/de.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,9 @@
9797
],
9898

9999
'currency' => [
100-
'int' => 'Mark',
101-
'fraction' => 'cent',
102-
'position' => 'after',
103-
'precision' => 2,
100+
'int' => 'Mark',
101+
'fraction' => 'cent',
102+
'position' => 'after',
104103
],
105104

106105
'zero' => 'null',

src/lang/en.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,9 @@
9797
],
9898

9999
'currency' => [
100-
'int' => 'dollars',
101-
'fraction' => 'cents',
102-
'position' => 'after',
103-
'precision' => 2,
100+
'int' => 'dollars',
101+
'fraction' => 'cents',
102+
'position' => 'after',
104103
],
105104

106105
'zero' => 'zero',

src/lang/ru.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,9 @@
9797
],
9898

9999
'currency' => [
100-
'int' => 'руб',
101-
'fraction' => 'коп',
102-
'position' => 'after',
103-
'precision' => 2,
100+
'int' => 'руб',
101+
'fraction' => 'коп',
102+
'position' => 'after',
104103
],
105104

106105
'zero' => 'ноль',

src/lang/uk.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,9 @@
9797
],
9898

9999
'currency' => [
100-
'int' => 'грн',
101-
'fraction' => 'коп',
102-
'position' => 'after',
103-
'precision' => 2,
100+
'int' => 'грн',
101+
'fraction' => 'коп',
102+
'position' => 'after',
104103
],
105104

106105
'zero' => 'нуль',

0 commit comments

Comments
 (0)