Lines
100.00%
7 / 7
Methods
100.00%
5 / 5
Classes
100.00%
1 / 1
| Name | Lines | Methods | CRAP | ||||
|---|---|---|---|---|---|---|---|
| captureOutput | 100.00% | 1 / 1 | 100.00% | 1 / 1 | 1 | ||
| isCaptured | 100.00% | 1 / 1 | 100.00% | 1 / 1 | 1 | ||
| disableCommand | 100.00% | 1 / 1 | 100.00% | 1 / 1 | 1 | ||
| register | 100.00% | 1 / 1 | 100.00% | 1 / 1 | 1 | ||
| execute | 100.00% | 3 / 3 | 100.00% | 1 / 1 | 1 | ||
| 16 | class CommandLine | |
| 17 | { | |
| 18 | private static bool $captureOutput = false; | |
| 19 | ||
| 20 | public static function captureOutput(bool $capture = true): void | |
| 21 | { | |
| 22 | self::$captureOutput = $capture; | |
| 23 | } | |
| 24 | ||
| 25 | public static function isCaptured(): bool | |
| 26 | { | |
| 27 | return self::$captureOutput; | |
| 28 | } | |
| 29 | ||
| 30 | public static function disableCommand(array|string $command) : void | |
| 31 | { | |
| 32 | Application::getInstance()->consoleRouter->disable($command); | |
| 33 | } | |
| 34 | ||
| 35 | public static function register(string $command, string $method, $class, ?string $description = null): void | |
| 36 | { | |
| 37 | Application::getInstance()->consoleRouter->registerRoute($command, CliRouter::$ROUTE_CLI, $method, $class, [], $description); | |
| 38 | } | |
| 39 | ||
| 40 | public static function execute(string $command): string | |
| 41 | { | |
| 42 | $args = explode(" ", $command); | |
| 43 | $_SERVER["REQUEST_METHOD"] = Router::$ROUTE_CLI; | |
| 44 | return Application::getInstance()->executeConsoleCommand($args); | |
| 45 | } | |
| 46 | } |