Skip to content

Commit 936a5fc

Browse files
committed
Rename namespaces
1 parent 18f5ea1 commit 936a5fc

28 files changed

Lines changed: 138 additions & 138 deletions

‎composer.json‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,12 @@
5050
"prefer-stable": true,
5151
"autoload": {
5252
"psr-4": {
53-
"Framework\\CLI\\": "src/"
53+
"Aplus\\Cli\\": "src/"
5454
}
5555
},
5656
"autoload-dev": {
5757
"psr-4": {
58-
"Tests\\CLI\\": "tests/"
58+
"Tests\\Cli\\": "tests/"
5959
}
6060
},
6161
"config": {

src/CLI.php renamed to src/Cli.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,22 @@
77
* For the full copyright and license information, please view the LICENSE
88
* file that was distributed with this source code.
99
*/
10-
namespace Framework\CLI;
10+
namespace Aplus\Cli;
1111

12-
use Framework\CLI\Styles\BackgroundColor;
13-
use Framework\CLI\Styles\ForegroundColor;
14-
use Framework\CLI\Styles\Format;
12+
use Aplus\Cli\Styles\BackgroundColor;
13+
use Aplus\Cli\Styles\ForegroundColor;
14+
use Aplus\Cli\Styles\Format;
1515
use Stringable;
1616
use ValueError;
1717

1818
/**
19-
* Class CLI.
19+
* Class Cli.
2020
*
2121
* @see https://en.wikipedia.org/wiki/ANSI_escape_code
2222
*
2323
* @package cli
2424
*/
25-
class CLI
25+
class Cli
2626
{
2727
protected static string $reset = "\033[0m";
2828

‎src/Command.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* For the full copyright and license information, please view the LICENSE
88
* file that was distributed with this source code.
99
*/
10-
namespace Framework\CLI;
10+
namespace Aplus\Cli;
1111

1212
/**
1313
* Class Command.

‎src/Commands/About.php‎

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@
77
* For the full copyright and license information, please view the LICENSE
88
* file that was distributed with this source code.
99
*/
10-
namespace Framework\CLI\Commands;
10+
namespace Aplus\Cli\Commands;
1111

12-
use Framework\CLI\CLI;
13-
use Framework\CLI\Command;
14-
use Framework\CLI\Styles\ForegroundColor;
12+
use Aplus\Cli\Cli;
13+
use Aplus\Cli\Command;
14+
use Aplus\Cli\Styles\ForegroundColor;
1515

1616
/**
1717
* Class About.
@@ -23,11 +23,11 @@ class About extends Command
2323
public function run() : void
2424
{
2525
$lang = $this->console->getLanguage();
26-
CLI::write($lang->render('cli', 'about.line1'), ForegroundColor::brightGreen);
27-
CLI::write($lang->render('cli', 'about.line2'));
28-
CLI::write($lang->render('cli', 'about.line3'));
29-
CLI::write($lang->render('cli', 'about.line4'));
30-
CLI::write($lang->render('cli', 'about.line5'));
26+
Cli::write($lang->render('cli', 'about.line1'), ForegroundColor::brightGreen);
27+
Cli::write($lang->render('cli', 'about.line2'));
28+
Cli::write($lang->render('cli', 'about.line3'));
29+
Cli::write($lang->render('cli', 'about.line4'));
30+
Cli::write($lang->render('cli', 'about.line5'));
3131
}
3232

3333
public function getDescription() : string

‎src/Commands/Help.php‎

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@
77
* For the full copyright and license information, please view the LICENSE
88
* file that was distributed with this source code.
99
*/
10-
namespace Framework\CLI\Commands;
10+
namespace Aplus\Cli\Commands;
1111

12-
use Framework\CLI\CLI;
13-
use Framework\CLI\Command;
14-
use Framework\CLI\Styles\ForegroundColor;
12+
use Aplus\Cli\Cli;
13+
use Aplus\Cli\Command;
14+
use Aplus\Cli\Styles\ForegroundColor;
1515

1616
/**
1717
* Class Help.
@@ -33,40 +33,40 @@ protected function showCommand(string $commandName) : void
3333
{
3434
$command = $this->console->getCommand($commandName);
3535
if ($command === null) {
36-
CLI::error(
36+
Cli::error(
3737
$this->console->getLanguage()->render('cli', 'commandNotFound', [$commandName]),
3838
\defined('TESTING') ? null : 1
3939
);
4040
return;
4141
}
42-
CLI::write(CLI::style(
42+
Cli::write(Cli::style(
4343
$this->console->getLanguage()->render('cli', 'command') . ': ',
4444
ForegroundColor::green
4545
) . $command->getName());
4646
$value = $command->getGroup();
4747
if ($value !== null) {
48-
CLI::write(CLI::style(
48+
Cli::write(Cli::style(
4949
$this->console->getLanguage()->render('cli', 'group') . ': ',
5050
ForegroundColor::green
5151
) . $value);
5252
}
5353
$value = $command->getDescription();
5454
if ($value !== '') {
55-
CLI::write(CLI::style(
55+
Cli::write(Cli::style(
5656
$this->console->getLanguage()->render('cli', 'description') . ': ',
5757
ForegroundColor::green
5858
) . $value);
5959
}
6060
$value = $command->getUsage();
6161
if ($value !== '') {
62-
CLI::write(CLI::style(
62+
Cli::write(Cli::style(
6363
$this->console->getLanguage()->render('cli', 'usage') . ': ',
6464
ForegroundColor::green
6565
) . $value);
6666
}
6767
$value = $command->getOptions();
6868
if ($value) {
69-
CLI::write(
69+
Cli::write(
7070
$this->console->getLanguage()->render('cli', 'options') . ': ',
7171
ForegroundColor::green
7272
);
@@ -78,14 +78,14 @@ protected function showCommand(string $commandName) : void
7878
\ksort($newOptions);
7979
$lastKey = \array_key_last($newOptions);
8080
foreach ($newOptions as $option => $description) {
81-
CLI::write(' ' . $this->setColor($option));
81+
Cli::write(' ' . $this->setColor($option));
8282
$description = \trim($description);
8383
if (!\str_ends_with($description, '.')) {
8484
$description .= '.';
8585
}
86-
CLI::write(' ' . $description);
86+
Cli::write(' ' . $description);
8787
if ($option !== $lastKey) {
88-
CLI::newLine();
88+
Cli::newLine();
8989
}
9090
}
9191
}
@@ -103,7 +103,7 @@ protected function setColor(string $text) : string
103103
{
104104
$text = \explode(',', $text);
105105
foreach ($text as &$item) {
106-
$item = CLI::style($item, ForegroundColor::yellow);
106+
$item = Cli::style($item, ForegroundColor::yellow);
107107
}
108108
return \implode(', ', $text);
109109
}

‎src/Commands/Index.php‎

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@
77
* For the full copyright and license information, please view the LICENSE
88
* file that was distributed with this source code.
99
*/
10-
namespace Framework\CLI\Commands;
10+
namespace Aplus\Cli\Commands;
1111

12-
use Framework\CLI\CLI;
13-
use Framework\CLI\Command;
14-
use Framework\CLI\Styles\ForegroundColor;
12+
use Aplus\Cli\Cli;
13+
use Aplus\Cli\Command;
14+
use Aplus\Cli\Styles\ForegroundColor;
1515

1616
/**
1717
* Class Index.
@@ -61,27 +61,27 @@ protected function listCommands() : void
6161
}
6262
$groups[$group][$name] = $command;
6363
}
64-
CLI::write(
64+
Cli::write(
6565
$this->console->getLanguage()->render('cli', 'availableCommands') . ':',
6666
ForegroundColor::yellow
6767
);
6868
[$width, $lengths] = $this->getWidthAndLengths($groupDefault);
6969
foreach ($groupDefault as $name => $command) {
70-
CLI::write(
71-
' ' . CLI::style($name, ForegroundColor::green) . ' '
70+
Cli::write(
71+
' ' . Cli::style($name, ForegroundColor::green) . ' '
7272
// @phpstan-ignore-next-line
7373
. \str_repeat(' ', $width - $lengths[$name])
7474
. $this->editDescription($command->getDescription())
7575
);
7676
}
7777
\ksort($groups);
7878
foreach ($groups as $groupName => $commands) {
79-
CLI::newLine();
80-
CLI::write(' ' . $groupName . ':', ForegroundColor::brightYellow);
79+
Cli::newLine();
80+
Cli::write(' ' . $groupName . ':', ForegroundColor::brightYellow);
8181
[$width, $lengths] = $this->getWidthAndLengths($commands);
8282
foreach ($commands as $name => $command) {
83-
CLI::write(
84-
' ' . CLI::style($name, ForegroundColor::green) . ' '
83+
Cli::write(
84+
' ' . Cli::style($name, ForegroundColor::green) . ' '
8585
// @phpstan-ignore-next-line
8686
. \str_repeat(' ', $width - $lengths[$name])
8787
. $this->editDescription($command->getDescription())
@@ -128,7 +128,7 @@ protected function showHeader() : void
128128
|_|
129129

130130
EOL;
131-
CLI::write($text, ForegroundColor::green);
131+
Cli::write($text, ForegroundColor::green);
132132
}
133133

134134
protected function showDate() : void
@@ -137,7 +137,7 @@ protected function showDate() : void
137137
$text = \ucfirst($text) . ' - '
138138
. \date('H:i:s') . ' - '
139139
. \date_default_timezone_get() . \PHP_EOL;
140-
CLI::write($text);
140+
Cli::write($text);
141141
}
142142

143143
protected function greet() : void
@@ -151,8 +151,8 @@ protected function greet() : void
151151
}
152152
$greeting = $this->console->getLanguage()
153153
->render('cli', 'greet.' . $timing, [$this->getUser()]);
154-
CLI::write($greeting);
155-
CLI::newLine();
154+
Cli::write($greeting);
155+
Cli::newLine();
156156
}
157157

158158
protected function getUser() : string

‎src/Console.php‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@
77
* For the full copyright and license information, please view the LICENSE
88
* file that was distributed with this source code.
99
*/
10-
namespace Framework\CLI;
10+
namespace Aplus\Cli;
1111

12-
use Framework\CLI\Commands\About;
13-
use Framework\CLI\Commands\Help;
14-
use Framework\CLI\Commands\Index;
15-
use Framework\CLI\Styles\ForegroundColor;
12+
use Aplus\Cli\Commands\About;
13+
use Aplus\Cli\Commands\Help;
14+
use Aplus\Cli\Commands\Index;
15+
use Aplus\Cli\Styles\ForegroundColor;
1616
use Framework\Language\Language;
1717

1818
/**
@@ -266,7 +266,7 @@ public function run() : void
266266
}
267267
$command = $this->getCommand($this->command);
268268
if ($command === null) {
269-
CLI::error(CLI::style(
269+
Cli::error(Cli::style(
270270
$this->getLanguage()->render('cli', 'commandNotFound', [$this->command]),
271271
ForegroundColor::brightRed
272272
), \defined('TESTING') ? null : 1);

‎src/Streams/FilterStream.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* For the full copyright and license information, please view the LICENSE
88
* file that was distributed with this source code.
99
*/
10-
namespace Framework\CLI\Streams;
10+
namespace Aplus\Cli\Streams;
1111

1212
/**
1313
* Trait FilterStream.

‎src/Streams/Stderr.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* For the full copyright and license information, please view the LICENSE
88
* file that was distributed with this source code.
99
*/
10-
namespace Framework\CLI\Streams;
10+
namespace Aplus\Cli\Streams;
1111

1212
/**
1313
* Class Stderr.

‎src/Streams/Stdout.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* For the full copyright and license information, please view the LICENSE
88
* file that was distributed with this source code.
99
*/
10-
namespace Framework\CLI\Streams;
10+
namespace Aplus\Cli\Streams;
1111

1212
/**
1313
* Class Stdout.

0 commit comments

Comments
 (0)