Skip to content

Commit c9939e6

Browse files
Thierry Fortierbarryvdh
authored andcommitted
Renaming the fire() functions to handle() since it's what Laravel 5.5 expects. (#210)
1 parent 3c9cb26 commit c9939e6

File tree

5 files changed

+55
-66
lines changed

5 files changed

+55
-66
lines changed

src/Console/CleanCommand.php

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1-
<?php namespace Barryvdh\TranslationManager\Console;
1+
<?php
2+
3+
namespace Barryvdh\TranslationManager\Console;
24

35
use Barryvdh\TranslationManager\Manager;
46
use Illuminate\Console\Command;
57

6-
class CleanCommand extends Command {
7-
8+
class CleanCommand extends Command
9+
{
810
/**
911
* The console command name.
1012
*
@@ -19,7 +21,7 @@ class CleanCommand extends Command {
1921
*/
2022
protected $description = 'Clean empty translations';
2123

22-
/** @var \Barryvdh\TranslationManager\Manager */
24+
/** @var \Barryvdh\TranslationManager\Manager */
2325
protected $manager;
2426

2527
public function __construct(Manager $manager)
@@ -30,13 +32,10 @@ public function __construct(Manager $manager)
3032

3133
/**
3234
* Execute the console command.
33-
*
34-
* @return void
3535
*/
36-
public function fire()
36+
public function handle()
3737
{
3838
$this->manager->cleanTranslations();
39-
$this->info("Done cleaning translations");
39+
$this->info('Done cleaning translations');
4040
}
41-
4241
}

src/Console/ExportCommand.php

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
1-
<?php namespace Barryvdh\TranslationManager\Console;
1+
<?php
2+
3+
namespace Barryvdh\TranslationManager\Console;
24

35
use Barryvdh\TranslationManager\Manager;
46
use Illuminate\Console\Command;
57
use Symfony\Component\Console\Input\InputArgument;
68
use Symfony\Component\Console\Input\InputOption;
79

8-
class ExportCommand extends Command {
9-
10+
class ExportCommand extends Command
11+
{
1012
/**
1113
* The console command name.
1214
*
@@ -21,7 +23,7 @@ class ExportCommand extends Command {
2123
*/
2224
protected $description = 'Export translations to PHP files';
2325

24-
/** @var \Barryvdh\TranslationManager\Manager */
26+
/** @var \Barryvdh\TranslationManager\Manager */
2527
protected $manager;
2628

2729
public function __construct(Manager $manager)
@@ -32,30 +34,30 @@ public function __construct(Manager $manager)
3234

3335
/**
3436
* Execute the console command.
35-
*
36-
* @return void
3737
*/
38-
public function fire()
38+
public function handle()
3939
{
4040
$group = $this->argument('group');
4141
$json = $this->option('json');
4242

4343
if (is_null($group) && !$json) {
44-
$this->warn("You must either specify a group argument or export as --json");
44+
$this->warn('You must either specify a group argument or export as --json');
45+
4546
return;
4647
}
4748

4849
if (!is_null($group) && $json) {
49-
$this->warn("You cannot use both group argument and --json option at the same time");
50+
$this->warn('You cannot use both group argument and --json option at the same time');
51+
5052
return;
5153
}
5254

5355
$this->manager->exportTranslations($group, $json);
5456

5557
if (!is_null($group)) {
56-
$this->info("Done writing language files for " . (($group == '*') ? 'ALL groups' : $group . " group") );
57-
} else if ($json) {
58-
$this->info("Done writing JSON language files for translation strings");
58+
$this->info('Done writing language files for '.(($group == '*') ? 'ALL groups' : $group.' group'));
59+
} elseif ($json) {
60+
$this->info('Done writing JSON language files for translation strings');
5961
}
6062
}
6163

@@ -66,9 +68,9 @@ public function fire()
6668
*/
6769
protected function getArguments()
6870
{
69-
return array(
70-
array('group', InputArgument::OPTIONAL, 'The group to export (`*` for all).'),
71-
);
71+
return [
72+
['group', InputArgument::OPTIONAL, 'The group to export (`*` for all).'],
73+
];
7274
}
7375

7476
/**
@@ -78,10 +80,8 @@ protected function getArguments()
7880
*/
7981
protected function getOptions()
8082
{
81-
return array(
82-
array('json', "J", InputOption::VALUE_NONE, 'Export anonymous strings to JSON'),
83-
);
83+
return [
84+
['json', 'J', InputOption::VALUE_NONE, 'Export anonymous strings to JSON'],
85+
];
8486
}
85-
86-
8787
}

src/Console/FindCommand.php

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1-
<?php namespace Barryvdh\TranslationManager\Console;
1+
<?php
2+
3+
namespace Barryvdh\TranslationManager\Console;
24

35
use Barryvdh\TranslationManager\Manager;
46
use Illuminate\Console\Command;
57

6-
class FindCommand extends Command {
7-
8+
class FindCommand extends Command
9+
{
810
/**
911
* The console command name.
1012
*
@@ -19,7 +21,7 @@ class FindCommand extends Command {
1921
*/
2022
protected $description = 'Find translations in php/twig files';
2123

22-
/** @var \Barryvdh\TranslationManager\Manager */
24+
/** @var \Barryvdh\TranslationManager\Manager */
2325
protected $manager;
2426

2527
public function __construct(Manager $manager)
@@ -28,18 +30,12 @@ public function __construct(Manager $manager)
2830
parent::__construct();
2931
}
3032

31-
3233
/**
3334
* Execute the console command.
34-
*
35-
* @return void
3635
*/
37-
public function fire()
36+
public function handle()
3837
{
3938
$counter = $this->manager->findTranslations(null);
40-
$this->info('Done importing, processed '.$counter. ' items!');
41-
39+
$this->info('Done importing, processed '.$counter.' items!');
4240
}
43-
44-
4541
}

src/Console/ImportCommand.php

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1-
<?php namespace Barryvdh\TranslationManager\Console;
1+
<?php
2+
3+
namespace Barryvdh\TranslationManager\Console;
24

35
use Barryvdh\TranslationManager\Manager;
46
use Illuminate\Console\Command;
57
use Symfony\Component\Console\Input\InputOption;
68

7-
class ImportCommand extends Command {
8-
9+
class ImportCommand extends Command
10+
{
911
/**
1012
* The console command name.
1113
*
@@ -20,7 +22,7 @@ class ImportCommand extends Command {
2022
*/
2123
protected $description = 'Import translations from the PHP sources';
2224

23-
/** @var \Barryvdh\TranslationManager\Manager */
25+
/** @var \Barryvdh\TranslationManager\Manager */
2426
protected $manager;
2527

2628
public function __construct(Manager $manager)
@@ -29,18 +31,14 @@ public function __construct(Manager $manager)
2931
parent::__construct();
3032
}
3133

32-
3334
/**
3435
* Execute the console command.
35-
*
36-
* @return void
3736
*/
38-
public function fire()
37+
public function handle()
3938
{
4039
$replace = $this->option('replace');
4140
$counter = $this->manager->importTranslations($replace);
42-
$this->info('Done importing, processed '.$counter. ' items!');
43-
41+
$this->info('Done importing, processed '.$counter.' items!');
4442
}
4543

4644
/**
@@ -50,10 +48,8 @@ public function fire()
5048
*/
5149
protected function getOptions()
5250
{
53-
return array(
54-
array('replace', "R", InputOption::VALUE_NONE, 'Replace existing keys'),
55-
);
51+
return [
52+
['replace', 'R', InputOption::VALUE_NONE, 'Replace existing keys'],
53+
];
5654
}
57-
58-
5955
}

src/Console/ResetCommand.php

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1-
<?php namespace Barryvdh\TranslationManager\Console;
1+
<?php
2+
3+
namespace Barryvdh\TranslationManager\Console;
24

35
use Illuminate\Console\Command;
46
use Barryvdh\TranslationManager\Manager;
57

6-
class ResetCommand extends Command {
7-
8+
class ResetCommand extends Command
9+
{
810
/**
911
* The console command name.
1012
*
@@ -19,7 +21,7 @@ class ResetCommand extends Command {
1921
*/
2022
protected $description = 'Delete all translations from the database';
2123

22-
/** @var \Barryvdh\TranslationManager\Manager */
24+
/** @var \Barryvdh\TranslationManager\Manager */
2325
protected $manager;
2426

2527
public function __construct(Manager $manager)
@@ -30,14 +32,10 @@ public function __construct(Manager $manager)
3032

3133
/**
3234
* Execute the console command.
33-
*
34-
* @return void
3535
*/
36-
public function fire()
36+
public function handle()
3737
{
3838
$this->manager->truncateTranslations();
39-
$this->info("All translations are deleted");
39+
$this->info('All translations are deleted');
4040
}
41-
42-
4341
}

0 commit comments

Comments
 (0)