diff --git a/src/Console/Commands/AddLanguageCommand.php b/src/Console/Commands/AddLanguage.php similarity index 94% rename from src/Console/Commands/AddLanguageCommand.php rename to src/Console/Commands/AddLanguage.php index 1b10870..f10d653 100644 --- a/src/Console/Commands/AddLanguageCommand.php +++ b/src/Console/Commands/AddLanguage.php @@ -2,7 +2,7 @@ namespace JoeDixon\Translation\Console\Commands; -class AddLanguageCommand extends BaseCommand +class AddLanguage extends Command { protected $signature = 'translation:add-language'; diff --git a/src/Console/Commands/AddTranslationKeyCommand.php b/src/Console/Commands/AddTranslationKey.php similarity index 97% rename from src/Console/Commands/AddTranslationKeyCommand.php rename to src/Console/Commands/AddTranslationKey.php index 43fa60a..da39008 100644 --- a/src/Console/Commands/AddTranslationKeyCommand.php +++ b/src/Console/Commands/AddTranslationKey.php @@ -2,7 +2,7 @@ namespace JoeDixon\Translation\Console\Commands; -class AddTranslationKeyCommand extends BaseCommand +class AddTranslationKey extends Command { protected $signature = 'translation:add-translation-key'; diff --git a/src/Console/Commands/BaseCommand.php b/src/Console/Commands/Command.php similarity index 73% rename from src/Console/Commands/BaseCommand.php rename to src/Console/Commands/Command.php index 57e6e1c..9bb6360 100644 --- a/src/Console/Commands/BaseCommand.php +++ b/src/Console/Commands/Command.php @@ -2,10 +2,10 @@ namespace JoeDixon\Translation\Console\Commands; -use Illuminate\Console\Command; +use Illuminate\Console\Command as BaseCommand; use JoeDixon\Translation\Drivers\Translation; -class BaseCommand extends Command +class Command extends BaseCommand { public function __construct(protected Translation $translation) { diff --git a/src/Console/Commands/ListLanguagesCommand.php b/src/Console/Commands/ListLanguages.php similarity index 93% rename from src/Console/Commands/ListLanguagesCommand.php rename to src/Console/Commands/ListLanguages.php index bbdcdaa..1b1844b 100644 --- a/src/Console/Commands/ListLanguagesCommand.php +++ b/src/Console/Commands/ListLanguages.php @@ -2,7 +2,7 @@ namespace JoeDixon\Translation\Console\Commands; -class ListLanguagesCommand extends BaseCommand +class ListLanguages extends Command { protected $signature = 'translation:list-languages'; diff --git a/src/Console/Commands/ListMissingTranslationKeys.php b/src/Console/Commands/ListMissingTranslationKeys.php index b17c24d..43b3908 100644 --- a/src/Console/Commands/ListMissingTranslationKeys.php +++ b/src/Console/Commands/ListMissingTranslationKeys.php @@ -2,7 +2,7 @@ namespace JoeDixon\Translation\Console\Commands; -class ListMissingTranslationKeys extends BaseCommand +class ListMissingTranslationKeys extends Command { protected $signature = 'translation:list-missing-translation-keys'; @@ -13,9 +13,9 @@ public function handle() $missingTranslations = []; $rows = []; - foreach ($this->translation->allLanguages() as $language => $name) { + $this->translation->allLanguages()->each(function ($language) { $missingTranslations[$language] = $this->translation->findMissingTranslations($language); - } + }); // check whether or not there are any missing translations $empty = true; diff --git a/src/Console/Commands/SynchroniseMissingTranslationKeys.php b/src/Console/Commands/SynchroniseMissingTranslationKeys.php index c1ffc19..37d5f19 100644 --- a/src/Console/Commands/SynchroniseMissingTranslationKeys.php +++ b/src/Console/Commands/SynchroniseMissingTranslationKeys.php @@ -2,7 +2,7 @@ namespace JoeDixon\Translation\Console\Commands; -class SynchroniseMissingTranslationKeys extends BaseCommand +class SynchroniseMissingTranslationKeys extends Command { protected $signature = 'translation:sync-missing-translation-keys {language?}'; diff --git a/src/Console/Commands/SynchroniseTranslationsCommand.php b/src/Console/Commands/SynchroniseTranslations.php similarity index 98% rename from src/Console/Commands/SynchroniseTranslationsCommand.php rename to src/Console/Commands/SynchroniseTranslations.php index 62231f3..bb7cf4d 100644 --- a/src/Console/Commands/SynchroniseTranslationsCommand.php +++ b/src/Console/Commands/SynchroniseTranslations.php @@ -9,7 +9,7 @@ use JoeDixon\Translation\Drivers\Translation; use JoeDixon\Translation\Scanner; -class SynchroniseTranslationsCommand extends Command +class SynchroniseTranslations extends Command { protected $signature = 'translation:sync-translations {from?} {to?} {language?}'; diff --git a/src/TranslationServiceProvider.php b/src/TranslationServiceProvider.php index 5684574..7f468ff 100644 --- a/src/TranslationServiceProvider.php +++ b/src/TranslationServiceProvider.php @@ -4,12 +4,12 @@ use Illuminate\Filesystem\Filesystem; use Illuminate\Support\ServiceProvider; -use JoeDixon\Translation\Console\Commands\AddLanguageCommand; -use JoeDixon\Translation\Console\Commands\AddTranslationKeyCommand; -use JoeDixon\Translation\Console\Commands\ListLanguagesCommand; +use JoeDixon\Translation\Console\Commands\AddLanguage; +use JoeDixon\Translation\Console\Commands\AddTranslationKey; +use JoeDixon\Translation\Console\Commands\ListLanguages; use JoeDixon\Translation\Console\Commands\ListMissingTranslationKeys; use JoeDixon\Translation\Console\Commands\SynchroniseMissingTranslationKeys; -use JoeDixon\Translation\Console\Commands\SynchroniseTranslationsCommand; +use JoeDixon\Translation\Console\Commands\SynchroniseTranslations; use JoeDixon\Translation\Drivers\Translation; class TranslationServiceProvider extends ServiceProvider @@ -57,10 +57,10 @@ public function register() */ private function loadViews() { - $this->loadViewsFrom(__DIR__.'/../resources/views', 'translation'); + $this->loadViewsFrom(__DIR__ . '/../resources/views', 'translation'); $this->publishes([ - __DIR__.'/../resources/views' => resource_path('views/vendor/translation'), + __DIR__ . '/../resources/views' => resource_path('views/vendor/translation'), ]); } @@ -71,7 +71,7 @@ private function loadViews() */ private function registerRoutes() { - $this->loadRoutesFrom(__DIR__.'/../routes/web.php'); + $this->loadRoutesFrom(__DIR__ . '/../routes/web.php'); } /** @@ -82,7 +82,7 @@ private function registerRoutes() private function publishConfiguration() { $this->publishes([ - __DIR__.'/../config/translation.php' => config_path('translation.php'), + __DIR__ . '/../config/translation.php' => config_path('translation.php'), ], 'config'); } @@ -93,7 +93,7 @@ private function publishConfiguration() */ private function mergeConfiguration() { - $this->mergeConfigFrom(__DIR__.'/../config/translation.php', 'translation'); + $this->mergeConfigFrom(__DIR__ . '/../config/translation.php', 'translation'); } /** @@ -104,7 +104,7 @@ private function mergeConfiguration() private function publishAssets() { $this->publishes([ - __DIR__.'/../public/assets' => public_path('vendor/translation'), + __DIR__ . '/../public/assets' => public_path('vendor/translation'), ], 'assets'); } @@ -119,7 +119,7 @@ private function loadMigrations() return; } - $this->loadMigrationsFrom(__DIR__.'/../database/migrations'); + $this->loadMigrationsFrom(__DIR__ . '/../database/migrations'); } /** @@ -129,10 +129,10 @@ private function loadMigrations() */ private function loadTranslations() { - $this->loadTranslationsFrom(__DIR__.'/../resources/lang', 'translation'); + $this->loadTranslationsFrom(__DIR__ . '/../resources/lang', 'translation'); $this->publishes([ - __DIR__.'/../resources/lang' => resource_path('lang/vendor/translation'), + __DIR__ . '/../resources/lang' => resource_path('lang/vendor/translation'), ]); } @@ -145,12 +145,12 @@ private function registerCommands() { if ($this->app->runningInConsole()) { $this->commands([ - AddLanguageCommand::class, - AddTranslationKeyCommand::class, - ListLanguagesCommand::class, + AddLanguage::class, + AddTranslationKey::class, + ListLanguages::class, ListMissingTranslationKeys::class, SynchroniseMissingTranslationKeys::class, - SynchroniseTranslationsCommand::class, + SynchroniseTranslations::class, ]); } } @@ -162,7 +162,7 @@ private function registerCommands() */ private function registerHelpers() { - require __DIR__.'/../resources/helpers.php'; + require __DIR__ . '/../resources/helpers.php'; } /**