Skip to content

Commit 8335c56

Browse files
committed
refactor(outputs): update visibility modifier for constructor properties
- Change property visibility from 'protected' to 'private' in constructors across various Output classes. - Update `shouldOutput` method to call `resolve` for LaravelDebugbar in DebugBarOutput. - Add return type to `fn` in LogOutput for better clarity.
1 parent dfe2d01 commit 8335c56

File tree

5 files changed

+9
-9
lines changed

5 files changed

+9
-9
lines changed

src/Outputs/ConsoleOutput.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
class ConsoleOutput extends AbstractOutput
2121
{
22-
public function __construct(protected string $method = 'warn') {}
22+
public function __construct(private string $method = 'warn') {}
2323

2424
/**
2525
* @noinspection PhpMissingParentCallCommonInspection

src/Outputs/DebugBarOutput.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,18 @@
2222
class DebugBarOutput extends AbstractOutput
2323
{
2424
public function __construct(
25-
protected string $name = 'Soar Scores',
26-
protected string $label = 'warning'
25+
private string $name = 'Soar Scores',
26+
private string $label = 'warning'
2727
) {}
2828

2929
/**
3030
* @noinspection PhpMissingParentCallCommonInspection
3131
*/
3232
public function shouldOutput(CommandFinished|Response $outputter): bool
3333
{
34-
// app(LaravelDebugbar::class)->isEnabled()
3534
return class_exists(LaravelDebugbar::class)
3635
&& app()->has(LaravelDebugbar::class)
36+
&& resolve(LaravelDebugbar::class)->isEnabled()
3737
&& $this->isHtmlResponse($outputter);
3838
}
3939

src/Outputs/JsonOutput.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
class JsonOutput extends AbstractOutput
2323
{
24-
public function __construct(protected string $key = 'soar_scores') {}
24+
public function __construct(private string $key = 'soar_scores') {}
2525

2626
/**
2727
* @noinspection PhpMissingParentCallCommonInspection

src/Outputs/LogOutput.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,16 @@
2121
class LogOutput extends AbstractOutput
2222
{
2323
public function __construct(
24-
protected string $channel = 'daily',
25-
protected string $level = 'warning'
24+
private string $channel = 'daily',
25+
private string $level = 'warning'
2626
) {}
2727

2828
/**
2929
* @throws \JsonException
3030
*/
3131
public function output(Collection $scores, CommandFinished|Response $outputter): CommandFinished|Response
3232
{
33-
$scores->each(fn (array $score) => Log::channel($this->channel)->log(
33+
$scores->each(fn (array $score): mixed => Log::channel($this->channel)->log(
3434
$this->level,
3535
$this->hydrateScore($score)
3636
));

src/Outputs/RayOutput.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
class RayOutput extends AbstractOutput
2121
{
22-
public function __construct(protected string $label = 'Soar Scores') {}
22+
public function __construct(private string $label = 'Soar Scores') {}
2323

2424
/**
2525
* @noinspection PhpMissingParentCallCommonInspection

0 commit comments

Comments
 (0)