Skip to content

Commit

Permalink
Normalise commands
Browse files Browse the repository at this point in the history
  • Loading branch information
joedixon committed Jul 11, 2022
1 parent b51b05a commit 931265c
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace JoeDixon\Translation\Console\Commands;

class AddLanguageCommand extends BaseCommand
class AddLanguage extends Command
{
protected $signature = 'translation:add-language';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace JoeDixon\Translation\Console\Commands;

class AddTranslationKeyCommand extends BaseCommand
class AddTranslationKey extends Command
{
protected $signature = 'translation:add-translation-key';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace JoeDixon\Translation\Console\Commands;

class ListLanguagesCommand extends BaseCommand
class ListLanguages extends Command
{
protected $signature = 'translation:list-languages';

Expand Down
6 changes: 3 additions & 3 deletions src/Console/Commands/ListMissingTranslationKeys.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace JoeDixon\Translation\Console\Commands;

class ListMissingTranslationKeys extends BaseCommand
class ListMissingTranslationKeys extends Command
{
protected $signature = 'translation:list-missing-translation-keys';

Expand All @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/Console/Commands/SynchroniseMissingTranslationKeys.php
Original file line number Diff line number Diff line change
Expand Up @@ -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?}';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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?}';

Expand Down
36 changes: 18 additions & 18 deletions src/TranslationServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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'),
]);
}

Expand All @@ -71,7 +71,7 @@ private function loadViews()
*/
private function registerRoutes()
{
$this->loadRoutesFrom(__DIR__.'/../routes/web.php');
$this->loadRoutesFrom(__DIR__ . '/../routes/web.php');
}

/**
Expand All @@ -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');
}

Expand All @@ -93,7 +93,7 @@ private function publishConfiguration()
*/
private function mergeConfiguration()
{
$this->mergeConfigFrom(__DIR__.'/../config/translation.php', 'translation');
$this->mergeConfigFrom(__DIR__ . '/../config/translation.php', 'translation');
}

/**
Expand All @@ -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');
}

Expand All @@ -119,7 +119,7 @@ private function loadMigrations()
return;
}

$this->loadMigrationsFrom(__DIR__.'/../database/migrations');
$this->loadMigrationsFrom(__DIR__ . '/../database/migrations');
}

/**
Expand All @@ -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'),
]);
}

Expand All @@ -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,
]);
}
}
Expand All @@ -162,7 +162,7 @@ private function registerCommands()
*/
private function registerHelpers()
{
require __DIR__.'/../resources/helpers.php';
require __DIR__ . '/../resources/helpers.php';
}

/**
Expand Down

0 comments on commit 931265c

Please sign in to comment.