Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/Console/CleanCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class CleanCommand extends Command
*/
protected $description = 'Clean empty translations';

/** @var \Barryvdh\TranslationManager\Manager */
/** @var Manager */
protected $manager;

public function __construct(Manager $manager)
Expand All @@ -33,7 +33,7 @@ public function __construct(Manager $manager)
/**
* Execute the console command.
*/
public function handle()
public function handle(): void
{
$this->manager->cleanTranslations();
$this->info('Done cleaning translations');
Expand Down
12 changes: 6 additions & 6 deletions src/Console/ExportCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class ExportCommand extends Command
*/
protected $description = 'Export translations to PHP files';

/** @var \Barryvdh\TranslationManager\Manager */
/** @var Manager */
protected $manager;

public function __construct(Manager $manager)
Expand All @@ -35,7 +35,7 @@ public function __construct(Manager $manager)
/**
* Execute the console command.
*/
public function handle()
public function handle(): void
{
$group = $this->option('all') ? '*' : $this->argument('group');
$json = $this->option('json');
Expand All @@ -52,15 +52,15 @@ public function handle()
return;
}

if ( $group == '*' ) {
if ( $group === '*' ) {
$this->manager->exportAllTranslations();
}
else {
$this->manager->exportTranslations($group, $json);
}

if (!is_null($group)) {
$this->info('Done writing language files for '.(($group == '*') ? 'ALL groups' : $group.' group'));
$this->info('Done writing language files for '.(($group === '*') ? 'ALL groups' : $group.' group'));
} elseif ($json) {
$this->info('Done writing JSON language files for translation strings');
}
Expand All @@ -71,7 +71,7 @@ public function handle()
*
* @return array
*/
protected function getArguments()
protected function getArguments(): array
{
return [
['group', InputArgument::OPTIONAL, 'The group to export (--all for all).'],
Expand All @@ -83,7 +83,7 @@ protected function getArguments()
*
* @return array
*/
protected function getOptions()
protected function getOptions(): array
{
return [
['json', 'J', InputOption::VALUE_NONE, 'Export anonymous strings to JSON'],
Expand Down
4 changes: 2 additions & 2 deletions src/Console/FindCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class FindCommand extends Command
*/
protected $description = 'Find translations in php/twig files';

/** @var \Barryvdh\TranslationManager\Manager */
/** @var Manager */
protected $manager;

public function __construct(Manager $manager)
Expand All @@ -33,7 +33,7 @@ public function __construct(Manager $manager)
/**
* Execute the console command.
*/
public function handle()
public function handle(): void
{
$counter = $this->manager->findTranslations(null);
$this->info('Done importing, processed '.$counter.' items!');
Expand Down
6 changes: 3 additions & 3 deletions src/Console/ImportCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class ImportCommand extends Command
*/
protected $description = 'Import translations from the PHP sources';

/** @var \Barryvdh\TranslationManager\Manager */
/** @var Manager */
protected $manager;

public function __construct(Manager $manager)
Expand All @@ -34,7 +34,7 @@ public function __construct(Manager $manager)
/**
* Execute the console command.
*/
public function handle()
public function handle(): void
{
$replace = $this->option('replace');
$counter = $this->manager->importTranslations($replace);
Expand All @@ -46,7 +46,7 @@ public function handle()
*
* @return array
*/
protected function getOptions()
protected function getOptions(): array
{
return [
['replace', 'R', InputOption::VALUE_NONE, 'Replace existing keys'],
Expand Down
4 changes: 2 additions & 2 deletions src/Console/ResetCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class ResetCommand extends Command
*/
protected $description = 'Delete all translations from the database';

/** @var \Barryvdh\TranslationManager\Manager */
/** @var Manager */
protected $manager;

public function __construct(Manager $manager)
Expand All @@ -33,7 +33,7 @@ public function __construct(Manager $manager)
/**
* Execute the console command.
*/
public function handle()
public function handle(): void
{
$this->manager->truncateTranslations();
$this->info('All translations are deleted');
Expand Down
14 changes: 6 additions & 8 deletions src/Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public function getView($group = null)
return $this->getIndex($group);
}

protected function loadLocales()
protected function loadLocales(): array
{
//Set the default locale as the first one.
$locales = Translation::groupBy('locale')
Expand Down Expand Up @@ -111,22 +111,22 @@ public function postDelete($group, $key)
}
}

public function postImport(Request $request)
public function postImport(Request $request): array
{
$replace = $request->get('replace', false);
$counter = $this->manager->importTranslations($replace);

return ['status' => 'ok', 'counter' => $counter];
}

public function postFind()
public function postFind(): array
{
$numFound = $this->manager->findTranslations();

return ['status' => 'ok', 'counter' => (int) $numFound];
}

public function postPublish($group = null)
public function postPublish($group = null): array
{
$json = false;

Expand All @@ -146,10 +146,8 @@ public function postAddGroup(Request $request)
{
return redirect()->action('\Barryvdh\TranslationManager\Controller@getView',$group);
}
else
{
return redirect()->back();
}

return redirect()->back();
}

public function postAddLocale(Request $request)
Expand Down
Loading
Loading