Skip to content

Commit a8e52c1

Browse files
Merge pull request #96 from TheDragonCode/3.x
Renamed `silent` option with `mute`
2 parents 6d6ce87 + a4069d9 commit a8e52c1

File tree

13 files changed

+56
-27
lines changed

13 files changed

+56
-27
lines changed

src/Concerns/Optionable.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ trait Optionable
1717
protected array $options = [
1818
Options::CONNECTION,
1919
Options::FORCE,
20-
Options::SILENT,
20+
Options::MUTE,
2121
];
2222

2323
protected function configure(): void
@@ -48,7 +48,7 @@ protected function availableOptions(): array
4848
[Options::PATH, null, InputOption::VALUE_OPTIONAL, 'The path to the actions files to be executed'],
4949
[Options::REALPATH, null, InputOption::VALUE_NONE, 'Indicate any provided action file paths are pre-resolved absolute path'],
5050
[Options::STEP, null, InputOption::VALUE_OPTIONAL, 'Force the actions to be run so they can be rolled back individually'],
51-
[Options::SILENT, null, InputOption::VALUE_NONE, 'Turns off the output of informational messages'],
51+
[Options::MUTE, null, InputOption::VALUE_NONE, 'Turns off the output of informational messages'],
5252
];
5353
}
5454

src/Console/Fresh.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,6 @@ class Fresh extends Command
2222
Options::FORCE,
2323
Options::PATH,
2424
Options::REALPATH,
25-
Options::SILENT,
25+
Options::MUTE,
2626
];
2727
}

src/Console/Make.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,6 @@ class Make extends Command
2424
Options::FORCE,
2525
Options::PATH,
2626
Options::REALPATH,
27-
Options::SILENT,
27+
Options::MUTE,
2828
];
2929
}

src/Console/Migrate.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,6 @@ class Migrate extends Command
2222
Options::CONNECTION,
2323
Options::PATH,
2424
Options::REALPATH,
25-
Options::SILENT,
25+
Options::MUTE,
2626
];
2727
}

src/Console/Refresh.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,6 @@ class Refresh extends Command
2020
Options::FORCE,
2121
Options::PATH,
2222
Options::REALPATH,
23-
Options::SILENT,
23+
Options::MUTE,
2424
];
2525
}

src/Console/Reset.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,6 @@ class Reset extends Command
2020
Options::FORCE,
2121
Options::PATH,
2222
Options::REALPATH,
23-
Options::SILENT,
23+
Options::MUTE,
2424
];
2525
}

src/Console/Rollback.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,6 @@ class Rollback extends Command
2121
Options::PATH,
2222
Options::REALPATH,
2323
Options::STEP,
24-
Options::SILENT,
24+
Options::MUTE,
2525
];
2626
}

src/Console/Status.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,6 @@ class Status extends Command
2121
Options::CONNECTION,
2222
Options::PATH,
2323
Options::REALPATH,
24-
Options::SILENT,
24+
Options::MUTE,
2525
];
2626
}

src/Constants/Options.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@ class Options
1212

1313
public const FORCE = 'force';
1414

15+
public const MUTE = 'mute';
16+
1517
public const NAME = 'name';
1618

1719
public const PATH = 'path';
1820

1921
public const REALPATH = 'realpath';
2022

21-
public const SILENT = 'silent';
22-
2323
public const STEP = 'step';
2424
}

src/Notifications/Beautiful.php

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,43 +6,52 @@
66

77
use Closure;
88
use Illuminate\Console\View\Components\Factory;
9-
use Illuminate\Support\Optional;
109

1110
class Beautiful extends Notification
1211
{
13-
protected Factory|Optional|null $components = null;
12+
protected ?Factory $components = null;
1413

1514
public function line(string $string, ?string $style = null): void
1615
{
17-
$this->components()->line($style, $string, $this->verbosity);
16+
if ($this->canSpeak()) {
17+
$this->components()->line($style, $string, $this->verbosity);
18+
}
1819
}
1920

2021
public function info(string $string): void
2122
{
22-
$this->components()->info($string, $this->verbosity);
23+
if ($this->canSpeak()) {
24+
$this->components()->info($string, $this->verbosity);
25+
}
2326
}
2427

2528
public function warning(string $string): void
2629
{
27-
$this->components()->warn($string, $this->verbosity);
30+
if ($this->canSpeak()) {
31+
$this->components()->warn($string, $this->verbosity);
32+
}
2833
}
2934

3035
public function task(string $description, Closure $task): void
3136
{
32-
$this->components()->task($description, $task);
37+
if ($this->canSpeak()) {
38+
$this->components()->task($description, $task);
39+
}
3340
}
3441

3542
public function twoColumn(string $first, string $second): void
3643
{
37-
$this->components()->twoColumnDetail($first, $second, $this->verbosity);
44+
if ($this->canSpeak()) {
45+
$this->components()->twoColumnDetail($first, $second, $this->verbosity);
46+
}
3847
}
3948

40-
protected function components(): Factory|Optional
49+
protected function components(): Factory
4150
{
4251
if (! is_null($this->components)) {
4352
return $this->components;
4453
}
4554

46-
return $this->component = $this->canSpeak() ? new Factory($this->output) : optional();
55+
return $this->components = new Factory($this->output);
4756
}
4857
}

0 commit comments

Comments
 (0)