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

Commit 6610ee2

Browse files
author
Andrey Helldar
committed
Optimized langfile link
1 parent 00afdee commit 6610ee2

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/DigitText.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ public function get($digit = 0.0, string $lang = 'en', bool $is_currency = false
8282
*/
8383
private function setLang(string $lang = 'en')
8484
{
85-
$filename = sprintf('%s/lang/%s.php', __DIR__, $lang);
85+
$filename = $this->getLangFile($lang);
8686
$this->lang = file_exists($filename) ? $lang : $this->lang_fallback;
8787
}
8888

@@ -179,8 +179,7 @@ private function intl(): ?string
179179
*/
180180
private function loadTexts()
181181
{
182-
$filename = sprintf('%s/lang/%s.php', __DIR__, $this->lang);
183-
$this->texts = require $filename;
182+
$this->texts = require $this->getLangFile();
184183
}
185184

186185
/**
@@ -334,4 +333,9 @@ private function getCurrency(string $content = null): string
334333

335334
return $result;
336335
}
336+
337+
private function getLangFile(string $lang = null): string
338+
{
339+
return sprintf('%s/lang/%s.php', __DIR__, $lang ?: $this->lang);
340+
}
337341
}

0 commit comments

Comments
 (0)