Skip to content

Commit 80bb2a8

Browse files
authored
Merge pull request #2 from SolumDeSignum/dev
Dev
2 parents b21aacd + c647dc9 commit 80bb2a8

File tree

3 files changed

+11
-13
lines changed

3 files changed

+11
-13
lines changed

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
],
2121
"homepage": "https://github.com/solumdesignum/package-translator-loader",
2222
"require": {
23-
"php": "^8.0|^8.1|^8.2",
24-
"illuminate/support": "^9|^10"
23+
"php": "^8.1|^8.2|^8.3",
24+
"illuminate/support": "^10|^11"
2525
},
2626
"require-dev": {
2727
"phpunit/phpunit": "~8|~9|~10",

src/PackageTranslatorLoader.php

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,15 @@
99
use Illuminate\Translation\FileLoader;
1010
use Illuminate\Translation\Translator;
1111

12-
use function app;
13-
use function config;
14-
1512
class PackageTranslatorLoader
1613
{
1714
public array $config;
1815

1916
public ?string $locale = null;
2017

21-
private string $translator;
18+
public string $translator;
2219

23-
private Application $app;
20+
public Application $app;
2421

2522
public function __construct(
2623
Application $app,
@@ -40,7 +37,7 @@ public function __construct(
4037
$this->loadTranslations();
4138
}
4239

43-
private function localeSetter(?string $locale): void
40+
public function localeSetter(?string $locale): void
4441
{
4542
if ($locale !== null) {
4643
$this->locale = $locale;
@@ -49,7 +46,7 @@ private function localeSetter(?string $locale): void
4946
}
5047
}
5148

52-
final public function setLocale(?string $locale = null): self
49+
public function setLocale(?string $locale = null): self
5350
{
5451
$this->locale = $locale;
5552

@@ -64,7 +61,7 @@ final public function setLocale(?string $locale = null): self
6461
*
6562
* @return void
6663
*/
67-
final public function loadTranslations(): void
64+
public function loadTranslations(): void
6865
{
6966
$this->app->bind(
7067
$this->translator,
@@ -91,7 +88,7 @@ function ($app) {
9188
);
9289
}
9390

94-
private function loader(): FileLoader
91+
public function loader(): FileLoader
9592
{
9693
$filesystem = new Filesystem();
9794
$resourcesLangPath = $this->config['packageRootPath'] . $this->config['loaderLangPath'];
@@ -100,7 +97,7 @@ private function loader(): FileLoader
10097
return new FileLoader($filesystem, $resourcesLangPath);
10198
}
10299

103-
private function locale(Application $app): string
100+
public function locale(Application $app): string
104101
{
105102
return $app
106103
->get('request')
@@ -109,7 +106,7 @@ private function locale(Application $app): string
109106
) ?: $app->getLocale();
110107
}
111108

112-
final public function trans(): mixed
109+
public function trans(): mixed
113110
{
114111
return app($this->translator);
115112
}

src/helpers.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
* @return mixed
1414
* @throws ContainerExceptionInterface
1515
* @throws NotFoundExceptionInterface
16+
* @throws Exception
1617
*/
1718
function translator(string $translator = null, string $key = null): mixed
1819
{

0 commit comments

Comments
 (0)