Skip to content

Commit 0eab307

Browse files
committed
Merge branch 'cleanup'
2 parents 308e22d + 696fb5f commit 0eab307

14 files changed

+20
-258
lines changed

scripts/generate.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
$facades = [
5858
Application::class => App::class,
5959
CacheStore::class => Cache::class,
60-
ConsoleWriter::class => Console::class,
60+
ConsoleWriter::class => [Console::class, '--api'],
6161
Container::class => DI::class,
6262
ErrorHandler::class => [Err::class, '--skip', 'handleShutdown,handleError,handleException'],
6363
EventDispatcher::class => Event::class,

src/Console/Catalog/ConsoleTag.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
use Lkrms\Concept\Enumeration;
66

77
/**
8-
* Inline console output formatting tags
8+
* Console output formatting tags
99
*
1010
* @extends Enumeration<int>
1111
*/
@@ -60,8 +60,6 @@ final class ConsoleTag extends Enumeration
6060
/**
6161
* Fenced code block
6262
*
63-
* Syntax:
64-
*
6563
* ` ``` `<br>
6664
* text<br>
6765
* ` ``` `

src/Console/ConsoleFormatter.php

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
use Lkrms\Console\Catalog\ConsoleMessageType as MessageType;
77
use Lkrms\Console\Catalog\ConsoleTag as Tag;
88
use Lkrms\Console\Contract\ConsoleFormatInterface as Format;
9+
use Lkrms\Console\Contract\ConsoleTargetInterface as Target;
910
use Lkrms\Console\Support\ConsoleMessageAttributes as MessageAttributes;
1011
use Lkrms\Console\Support\ConsoleMessageFormat as MessageFormat;
1112
use Lkrms\Console\Support\ConsoleMessageFormats as MessageFormats;
@@ -21,7 +22,7 @@
2122
/**
2223
* Formats messages for a console output target
2324
*
24-
* @see ConsoleTarget::getFormatter()
25+
* @see Target::getFormatter()
2526
*/
2627
final class ConsoleFormatter
2728
{
@@ -514,20 +515,17 @@ public static function removeTags(string $string): string
514515

515516
private static function getDefaultFormatter(): self
516517
{
517-
return self::$DefaultFormatter
518-
?? (self::$DefaultFormatter = new self());
518+
return self::$DefaultFormatter ??= new self();
519519
}
520520

521521
private static function getDefaultTagFormats(): TagFormats
522522
{
523-
return self::$DefaultTagFormats
524-
?? (self::$DefaultTagFormats = new TagFormats());
523+
return self::$DefaultTagFormats ??= new TagFormats();
525524
}
526525

527526
private static function getDefaultMessageFormats(): MessageFormats
528527
{
529-
return self::$DefaultMessageFormats
530-
?? (self::$DefaultMessageFormats = new MessageFormats());
528+
return self::$DefaultMessageFormats ??= new MessageFormats();
531529
}
532530

533531
/**

src/Console/Contract/ConsoleFormatInterface.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,12 @@
55
use Lkrms\Console\Support\ConsoleMessageAttributes as MessageAttributes;
66
use Lkrms\Console\Support\ConsoleTagAttributes as TagAttributes;
77

8-
/**
9-
* Applies target-defined formatting to console output
10-
*/
118
interface ConsoleFormatInterface
129
{
1310
/**
1411
* Format text before it is written to the target
1512
*
16-
* @param MessageAttributes|TagAttributes $attributes
13+
* @param MessageAttributes|TagAttributes|null $attributes
1714
*/
1815
public function apply(?string $text, $attributes = null): string;
1916
}

src/Console/Contract/ConsoleTargetInterface.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77

88
/**
99
* A console output target
10+
*
11+
* @api
1012
*/
1113
interface ConsoleTargetInterface
1214
{

src/Console/Contract/ConsoleTargetPrefixInterface.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
/**
66
* A console output target that applies an optional prefix to each line of
77
* output
8+
*
9+
* @api
810
*/
911
interface ConsoleTargetPrefixInterface extends ConsoleTargetInterface
1012
{

src/Console/Contract/ConsoleTargetStreamInterface.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
/**
66
* A console output target with an underlying PHP stream
7+
*
8+
* @api
79
*/
810
interface ConsoleTargetStreamInterface extends ConsoleTargetInterface
911
{

src/Console/Support/ConsoleFormat.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@
88
use Lkrms\Support\Catalog\TtyControlSequence as Colour;
99

1010
/**
11-
* Applies formatting to console output by adding inline character sequences
12-
* defined by the target
11+
* Applies inline character sequences to console output
1312
*/
1413
final class ConsoleFormat implements ConsoleFormatInterface
1514
{

src/Console/Support/ConsoleMessageFormat.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
use Lkrms\Console\Support\ConsoleMessageAttributes as MessageAttributes;
77

88
/**
9-
* Applies target-defined formats to the components of a console message
9+
* Applies formats to the components of a console message
1010
*/
1111
final class ConsoleMessageFormat
1212
{

src/Console/Support/ConsoleMessageFormats.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
use Lkrms\Console\Support\ConsoleMessageFormat as MessageFormat;
88

99
/**
10-
* Maps message levels and types to target-defined formats
10+
* Maps message levels and types to formats
1111
*
1212
* If multiple formats are assigned to the same {@see Level} and
1313
* {@see MessageType}, the format assigned last takes precedence.

0 commit comments

Comments
 (0)