Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
25 / 25 |
|
100.00% |
3 / 3 |
CRAP | |
100.00% |
1 / 1 |
| ConsoleServiceProvider | |
100.00% |
25 / 25 |
|
100.00% |
3 / 3 |
5 | |
100.00% |
1 / 1 |
| register | |
100.00% |
22 / 22 |
|
100.00% |
1 / 1 |
1 | |||
| logo | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
3 | |||
| boot | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace Hyde\Console; |
| 6 | |
| 7 | use Illuminate\Console\Application as Artisan; |
| 8 | use Illuminate\Support\ServiceProvider; |
| 9 | |
| 10 | use function in_array; |
| 11 | |
| 12 | /** |
| 13 | * Register the HydeCLI console commands. |
| 14 | */ |
| 15 | class ConsoleServiceProvider extends ServiceProvider |
| 16 | { |
| 17 | public function register(): void |
| 18 | { |
| 19 | $this->commands([ |
| 20 | Commands\BuildRssFeedCommand::class, |
| 21 | Commands\BuildSearchCommand::class, |
| 22 | Commands\BuildSiteCommand::class, |
| 23 | Commands\BuildSitemapCommand::class, |
| 24 | Commands\RebuildPageCommand::class, |
| 25 | |
| 26 | Commands\MakePageCommand::class, |
| 27 | Commands\MakePostCommand::class, |
| 28 | |
| 29 | Commands\VendorPublishCommand::class, |
| 30 | Commands\PublishConfigsCommand::class, |
| 31 | Commands\PublishHomepageCommand::class, |
| 32 | Commands\PublishViewsCommand::class, |
| 33 | Commands\PackageDiscoverCommand::class, |
| 34 | |
| 35 | Commands\RouteListCommand::class, |
| 36 | Commands\ValidateCommand::class, |
| 37 | Commands\ServeCommand::class, |
| 38 | Commands\DebugCommand::class, |
| 39 | |
| 40 | Commands\ChangeSourceDirectoryCommand::class, |
| 41 | ]); |
| 42 | |
| 43 | Artisan::starting(function (Artisan $artisan): void { |
| 44 | $artisan->setName(self::logo()); |
| 45 | }); |
| 46 | } |
| 47 | |
| 48 | protected static function logo(): string |
| 49 | { |
| 50 | // Check if no-ansi flag is set |
| 51 | if (isset($_SERVER['argv']) && in_array('--no-ansi', $_SERVER['argv'], true)) { |
| 52 | return 'HydePHP'; |
| 53 | } |
| 54 | |
| 55 | return <<<ASCII |
| 56 | |
| 57 | \033[94m __ __ __ \033[91m ___ __ _____ |
| 58 | \033[94m / // /_ _____/ /__ \033[91m/ _ \/ // / _ \ |
| 59 | \033[94m / _ / // / _ / -_)\033[91m ___/ _ / ___/ |
| 60 | \033[94m /_//_/\_, /\_,_/\__/\033[91m_/ /_//_/_/ |
| 61 | \033[94m /___/ |
| 62 | |
| 63 | \033[0m |
| 64 | ASCII; |
| 65 | } |
| 66 | |
| 67 | public function boot(): void |
| 68 | { |
| 69 | // |
| 70 | } |
| 71 | } |