-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #31 from ARCANEDEV/update-package
Updating the package
- Loading branch information
Showing
15 changed files
with
148 additions
and
178 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
<?php namespace Arcanedev\LaravelLang\Providers; | ||
|
||
use Arcanedev\LaravelLang\{Contracts, TransChecker, TransManager, TransPublisher}; | ||
use Arcanedev\Support\Providers\ServiceProvider; | ||
use Illuminate\Contracts\Support\DeferrableProvider; | ||
use Illuminate\Foundation\Application; | ||
|
||
/** | ||
* Class DeferredServiceProvider | ||
* | ||
* @package Arcanedev\LaravelLang\Providers | ||
* @author ARCANEDEV <[email protected]> | ||
*/ | ||
class DeferredServiceProvider extends ServiceProvider implements DeferrableProvider | ||
{ | ||
/* ----------------------------------------------------------------- | ||
| Main Methods | ||
| ----------------------------------------------------------------- | ||
*/ | ||
|
||
/** | ||
* Register any application services. | ||
*/ | ||
public function register(): void | ||
{ | ||
$this->registerTransManager(); | ||
$this->registerTransChecker(); | ||
$this->registerLangPublisher(); | ||
} | ||
|
||
/** | ||
* Get the services provided by the provider. | ||
* | ||
* @return array | ||
*/ | ||
public function provides(): array | ||
{ | ||
return [ | ||
Contracts\TransManager::class, | ||
Contracts\TransChecker::class, | ||
Contracts\TransPublisher::class, | ||
]; | ||
} | ||
|
||
/* ----------------------------------------------------------------- | ||
| Services | ||
| ----------------------------------------------------------------- | ||
*/ | ||
|
||
/** | ||
* Register the trans manager. | ||
*/ | ||
private function registerTransManager() | ||
{ | ||
$this->singleton(Contracts\TransManager::class, function (Application $app) { | ||
$paths = array_map('realpath', [ | ||
'app' => $app->langPath(), | ||
'vendor' => $app['config']->get('laravel-lang.vendor', ''), | ||
]); | ||
|
||
return new TransManager($app['files'], $paths); | ||
}); | ||
} | ||
|
||
/** | ||
* Register the trans checker. | ||
*/ | ||
private function registerTransChecker() | ||
{ | ||
$this->singleton(Contracts\TransChecker::class, function (Application $app) { | ||
return new TransChecker( | ||
$app['translator'], | ||
$app[Contracts\TransManager::class], | ||
$app['config']->get('laravel-lang', []) | ||
); | ||
}); | ||
} | ||
|
||
/** | ||
* Register the lang publisher. | ||
*/ | ||
private function registerLangPublisher() | ||
{ | ||
$this->singleton(Contracts\TransPublisher::class, function (Application $app) { | ||
return new TransPublisher( | ||
$app['files'], | ||
$app[Contracts\TransManager::class], | ||
$app->langPath() | ||
); | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.