Skip to content

Commit 2d093ba

Browse files
committed
update base formatter namespace
1 parent 80d4bc4 commit 2d093ba

File tree

14 files changed

+52
-65
lines changed

14 files changed

+52
-65
lines changed

src/Component/Formatter/Alert.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,12 @@
88

99
namespace Inhere\Console\Component\Formatter;
1010

11+
use Inhere\Console\Component\MessageFormatter;
12+
1113
/**
1214
* Class Alert
1315
* @package Inhere\Console\Component\Formatter
1416
*/
15-
class Alert extends Formatter
17+
class Alert extends MessageFormatter
1618
{
1719
}

src/Component/Formatter/Block.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,13 @@
88

99
namespace Inhere\Console\Component\Formatter;
1010

11+
use Inhere\Console\Component\MessageFormatter;
12+
1113
/**
1214
* Class Block
1315
* @package Inhere\Console\Component\Formatter
1416
*/
15-
class Block extends Formatter
17+
class Block extends MessageFormatter
1618
{
1719

1820
}

src/Component/Formatter/HelpPanel.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
namespace Inhere\Console\Component\Formatter;
1010

11+
use Inhere\Console\Component\MessageFormatter;
1112
use Inhere\Console\Util\FormatUtil;
1213
use Inhere\Console\Util\Show;
1314

@@ -16,7 +17,7 @@
1617
* - method version please {@see \Inhere\Console\Util\Show::helpPanel()}
1718
* @package Inhere\Console\Component\Formatter
1819
*/
19-
class HelpPanel extends Formatter
20+
class HelpPanel extends MessageFormatter
2021
{
2122
/**
2223
* help panel keys

src/Component/Formatter/MultiList.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,14 @@
22

33
namespace Inhere\Console\Component\Formatter;
44

5-
use Inhere\Console\Util\Show;
5+
use Inhere\Console\Component\MessageFormatter;
6+
use Inhere\Console\Console;
67

78
/**
89
* Class MultiList
910
* @package Inhere\Console\Component\Formatter
1011
*/
11-
class MultiList extends Formatter
12+
class MultiList extends MessageFormatter
1213
{
1314
/**
1415
* Format and render multi list
@@ -49,6 +50,6 @@ public static function show(array $data, array $opts = []): void
4950
$stringList[] = SingleList::show($list, $title, $opts);
5051
}
5152

52-
Show::write(\implode("\n", $stringList), $lastNewline);
53+
Console::write(\implode("\n", $stringList), $lastNewline);
5354
}
5455
}

src/Component/Formatter/Padding.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,16 @@
22

33
namespace Inhere\Console\Component\Formatter;
44

5+
use Inhere\Console\Component\MessageFormatter;
6+
use Inhere\Console\Console;
57
use Inhere\Console\Util\Helper;
6-
use Inhere\Console\Util\Show;
78
use Toolkit\Cli\ColorTag;
89

910
/**
1011
* Class Padding
1112
* @package Inhere\Console\Component\Formatter
1213
*/
13-
class Padding extends Formatter
14+
class Padding extends MessageFormatter
1415
{
1516
/**
1617
* ```php
@@ -47,6 +48,6 @@ public static function show(array $data, string $title = '', array $opts = []):
4748
$string .= $opts['indent'] . \str_pad($label, $paddingLen, $opts['char']) . " $value\n";
4849
}
4950

50-
Show::write(\trim($string));
51+
Console::write(\trim($string));
5152
}
5253
}

src/Component/Formatter/Panel.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
namespace Inhere\Console\Component\Formatter;
1010

11+
use Inhere\Console\Component\MessageFormatter;
1112
use Inhere\Console\Util\FormatUtil;
1213
use Inhere\Console\Util\Show;
1314
use Toolkit\StrUtil\StrBuffer;
@@ -17,7 +18,7 @@
1718
* - method version please {@see \Inhere\Console\Util\Show::panel()}
1819
* @package Inhere\Console\Component\Formatter
1920
*/
20-
class Panel extends Formatter
21+
class Panel extends MessageFormatter
2122
{
2223
/** @var string */
2324
public $title = '';

src/Component/Formatter/Section.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,16 @@
22

33
namespace Inhere\Console\Component\Formatter;
44

5+
use Inhere\Console\Component\MessageFormatter;
6+
use Inhere\Console\Console;
57
use Inhere\Console\Util\FormatUtil;
6-
use Inhere\Console\Util\Show;
78
use Toolkit\StrUtil\Str;
89

910
/**
1011
* Class Section
1112
* @package Inhere\Console\Component\Formatter
1213
*/
13-
class Section extends Formatter
14+
class Section extends MessageFormatter
1415
{
1516
/**
1617
* @param string $title The title text
@@ -71,6 +72,6 @@ public static function show(string $title, $body, array $opts = []): void
7172
$body = \is_array($body) ? \implode(\PHP_EOL, $body) : $body;
7273
$body = FormatUtil::wrapText($body, 4, $opts['width']);
7374

74-
Show::writef($template, $titleLine, $topBorder, $body, $bottomBorder);
75+
Console::writef($template, $titleLine, $topBorder, $body, $bottomBorder);
7576
}
7677
}

src/Component/Formatter/SingleList.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,16 @@
22

33
namespace Inhere\Console\Component\Formatter;
44

5+
use Inhere\Console\Component\MessageFormatter;
6+
use Inhere\Console\Console;
57
use Inhere\Console\Util\FormatUtil;
6-
use Inhere\Console\Util\Show;
78
use Toolkit\Cli\ColorTag;
89

910
/**
1011
* Class SingleList - Format and render a single list
1112
* @package Inhere\Console\Component\Formatter
1213
*/
13-
class SingleList extends Formatter
14+
class SingleList extends MessageFormatter
1415
{
1516
/**
1617
* Format and render a single list
@@ -55,6 +56,6 @@ public static function show($data, string $title = '', array $opts = [])
5556
return $string;
5657
}
5758

58-
return Show::write($string, $opts['lastNewline']);
59+
return Console::write($string, $opts['lastNewline']);
5960
}
6061
}

src/Component/Formatter/Table.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,16 @@
88

99
namespace Inhere\Console\Component\Formatter;
1010

11-
use Inhere\Console\Util\Show;
11+
use Inhere\Console\Component\MessageFormatter;
12+
use Inhere\Console\Console;
1213
use Toolkit\Cli\ColorTag;
1314
use Toolkit\StrUtil\StrBuffer;
1415

1516
/**
1617
* Class Table - Tabular data display
1718
* @package Inhere\Console\Component\Formatter
1819
*/
19-
class Table extends Formatter
20+
class Table extends MessageFormatter
2021
{
2122
/** @var array */
2223
public $data = [];
@@ -212,6 +213,6 @@ public static function show(array $data, string $title = 'Data Table', array $op
212213
$buf->write($border . "\n");
213214
}
214215

215-
return Show::write($buf);
216+
return Console::write($buf);
216217
}
217218
}

src/Component/Formatter/Title.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,16 @@
22

33
namespace Inhere\Console\Component\Formatter;
44

5+
use Inhere\Console\Component\MessageFormatter;
6+
use Inhere\Console\Console;
57
use Inhere\Console\Util\Show;
68
use Toolkit\StrUtil\Str;
79

810
/**
911
* Class Title
1012
* @package Inhere\Console\Component\Formatter
1113
*/
12-
class Title extends Formatter
14+
class Title extends MessageFormatter
1315
{
1416
/**
1517
* @param string $title The title text
@@ -49,6 +51,6 @@ public static function show(string $title, array $opts = []): void
4951
$titleLine = "$titleIndent<bold>$title</bold>\n";
5052
$border = $indentStr . \str_pad($char, $width, $char);
5153

52-
Show::write($titleLine . $border);
54+
Console::write($titleLine . $border);
5355
}
5456
}

0 commit comments

Comments
 (0)