@@ -389,9 +389,9 @@ |
||
| 389 | 389 | public function isLocale($locale): bool; |
| 390 | 390 | |
| 391 | 391 | /** |
| 392 | - * Shutdown the application. |
|
| 393 | - * |
|
| 394 | - * @return void |
|
| 395 | - */ |
|
| 396 | - public function shutdown(): void; |
|
| 392 | + * Shutdown the application. |
|
| 393 | + * |
|
| 394 | + * @return void |
|
| 395 | + */ |
|
| 396 | + public function shutdown(): void; |
|
| 397 | 397 | } |
| 398 | 398 | \ No newline at end of file |
@@ -44,7 +44,7 @@ |
||
| 44 | 44 | * |
| 45 | 45 | * @return static |
| 46 | 46 | */ |
| 47 | - public function define(string $ability, callable|string $callback): static; |
|
| 47 | + public function define(string $ability, callable | string $callback): static; |
|
| 48 | 48 | |
| 49 | 49 | /** |
| 50 | 50 | * Define abilities for a resource. |
@@ -31,14 +31,14 @@ discard block |
||
| 31 | 31 | */ |
| 32 | 32 | interface Application |
| 33 | 33 | { |
| 34 | - /** |
|
| 34 | + /** |
|
| 35 | 35 | * Gets the name of the application. |
| 36 | 36 | * |
| 37 | 37 | * @return string |
| 38 | 38 | */ |
| 39 | 39 | public function getName(): string; |
| 40 | 40 | |
| 41 | - /** |
|
| 41 | + /** |
|
| 42 | 42 | * Sets the name of the application. |
| 43 | 43 | * |
| 44 | 44 | * @param string $name The application name |
@@ -47,14 +47,14 @@ discard block |
||
| 47 | 47 | */ |
| 48 | 48 | public function setName(string $name): void; |
| 49 | 49 | |
| 50 | - /** |
|
| 50 | + /** |
|
| 51 | 51 | * Gets the version of the application. |
| 52 | 52 | * |
| 53 | 53 | * @return string |
| 54 | 54 | */ |
| 55 | 55 | public function getVersion(): string; |
| 56 | 56 | |
| 57 | - /** |
|
| 57 | + /** |
|
| 58 | 58 | * Sets the name of the application. |
| 59 | 59 | * |
| 60 | 60 | * @param string $version The application version |
@@ -63,17 +63,17 @@ discard block |
||
| 63 | 63 | */ |
| 64 | 64 | public function setVersion(string $version): void; |
| 65 | 65 | |
| 66 | - /** |
|
| 67 | - * Runs the current command discovered on the CLI. |
|
| 66 | + /** |
|
| 67 | + * Runs the current command discovered on the CLI. |
|
| 68 | 68 | * |
| 69 | 69 | * @param \Syscodes\Components\Contracts\Console\Input\Input|null $input The input interface implemented |
| 70 | 70 | * @param \Syscodes\Components\Contracts\Console\Output\Output|null $output The output interface implemented |
| 71 | 71 | * |
| 72 | 72 | * @return int |
| 73 | - */ |
|
| 74 | - public function run(InputInterface $input = null, OutputInterface $output = null); |
|
| 73 | + */ |
|
| 74 | + public function run(InputInterface $input = null, OutputInterface $output = null); |
|
| 75 | 75 | |
| 76 | - /** |
|
| 76 | + /** |
|
| 77 | 77 | * Executes the current application of console. |
| 78 | 78 | * |
| 79 | 79 | * @param \Syscodes\Components\Contracts\Console\Input\Input $input The input interface implemented |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | */ |
| 84 | 84 | public function doExecute(InputInterface $input, OutputInterface $output): int; |
| 85 | 85 | |
| 86 | - /** |
|
| 86 | + /** |
|
| 87 | 87 | * Adds a command object. |
| 88 | 88 | * |
| 89 | 89 | * @param \Syscodes\Components\Console\Command\Command $command |
@@ -94,14 +94,14 @@ discard block |
||
| 94 | 94 | */ |
| 95 | 95 | public function addCommand(Command $command); |
| 96 | 96 | |
| 97 | - /** |
|
| 97 | + /** |
|
| 98 | 98 | * Gets input definition. |
| 99 | 99 | * |
| 100 | 100 | * @return \Syscodes\Components\Console\Input\InputDefinition |
| 101 | 101 | */ |
| 102 | 102 | public function getDefinition(); |
| 103 | 103 | |
| 104 | - /** |
|
| 104 | + /** |
|
| 105 | 105 | * Finds a command by name. |
| 106 | 106 | * |
| 107 | 107 | * @param string $name The command name |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | */ |
| 113 | 113 | public function findCommand(string $name); |
| 114 | 114 | |
| 115 | - /** |
|
| 115 | + /** |
|
| 116 | 116 | * Gets a registered command. |
| 117 | 117 | * |
| 118 | 118 | * @param string $name The command name |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | */ |
| 124 | 124 | public function get(string $name); |
| 125 | 125 | |
| 126 | - /** |
|
| 126 | + /** |
|
| 127 | 127 | * Returns true if the command exists, false otherwise. |
| 128 | 128 | * |
| 129 | 129 | * @param string $name The command name |
@@ -132,18 +132,18 @@ discard block |
||
| 132 | 132 | */ |
| 133 | 133 | public function has(string $name): bool; |
| 134 | 134 | |
| 135 | - /** |
|
| 135 | + /** |
|
| 136 | 136 | * Runs the current command. |
| 137 | 137 | * |
| 138 | 138 | * @param \Syscodes\Components\Console\Command\Command $command The command name |
| 139 | 139 | * @param \Syscodes\Components\Contracts\Console\Input\Input $input The input interface implemented |
| 140 | - * @param \Syscodes\Components\Contracts\Console\Output\Output $output The output interface implemented |
|
| 140 | + * @param \Syscodes\Components\Contracts\Console\Output\Output $output The output interface implemented |
|
| 141 | 141 | * |
| 142 | 142 | * @return int 0 if everything went fine, or an error code |
| 143 | 143 | */ |
| 144 | 144 | public function doCommand(Command $command, InputInterface $input, OutputInterface $output): int; |
| 145 | 145 | |
| 146 | - /** |
|
| 146 | + /** |
|
| 147 | 147 | * Gets the help message. |
| 148 | 148 | * |
| 149 | 149 | * @return string |
@@ -29,123 +29,123 @@ |
||
| 29 | 29 | */ |
| 30 | 30 | interface Output |
| 31 | 31 | { |
| 32 | - // Output formatter |
|
| 33 | - public const OUTPUT_NORMAL = 1; |
|
| 34 | - public const OUTPUT_RAW = 2; |
|
| 35 | - public const OUTPUT_PLAIN = 3; |
|
| 36 | - |
|
| 37 | - // Output verbose |
|
| 38 | - public const VERBOSITY_QUIET = 16; |
|
| 39 | - public const VERBOSITY_NORMAL = 32; |
|
| 40 | - public const VERBOSITY_VERBOSE = 64; |
|
| 41 | - public const VERBOSITY_VERY_VERBOSE = 128; |
|
| 42 | - public const VERBOSITY_DEBUG = 256; |
|
| 43 | - |
|
| 44 | - /** |
|
| 45 | - * Gets the decorated flag. |
|
| 46 | - * |
|
| 47 | - * @return bool |
|
| 48 | - */ |
|
| 49 | - public function getDecorated(): bool; |
|
| 50 | - |
|
| 51 | - /** |
|
| 52 | - * Sets the decorated flag. |
|
| 53 | - * |
|
| 54 | - * @param bool $decorated Whether to decorated messages |
|
| 55 | - * |
|
| 56 | - * @return void |
|
| 57 | - */ |
|
| 58 | - public function setDecorated(bool $decorated): void; |
|
| 59 | - |
|
| 60 | - /** |
|
| 61 | - * Returns a output formatter instance. |
|
| 62 | - * |
|
| 63 | - * @return \Syscodes\Components\Contracts\Console\Output\OutputFormatter |
|
| 64 | - */ |
|
| 65 | - public function getFormatter(); |
|
| 66 | - |
|
| 67 | - /** |
|
| 68 | - * Sets a output formatter instance. |
|
| 69 | - * |
|
| 70 | - * @param \Syscodes\Components\Contracts\Console\Output\OutputFormatter $formatter; |
|
| 71 | - * |
|
| 72 | - * @return void |
|
| 73 | - */ |
|
| 74 | - public function setFormatter(OutputFormatterInterface $formatter): void; |
|
| 75 | - |
|
| 76 | - /** |
|
| 77 | - * Gets the current verbosity of the output. |
|
| 78 | - * |
|
| 79 | - * @return int |
|
| 80 | - */ |
|
| 81 | - public function getVerbosity(): int; |
|
| 82 | - |
|
| 83 | - /** |
|
| 84 | - * Sets the verbosity of the output. |
|
| 85 | - * |
|
| 86 | - * @param int $level |
|
| 87 | - * |
|
| 88 | - * @return void |
|
| 89 | - */ |
|
| 90 | - public function setVerbosity(int $level): void; |
|
| 91 | - |
|
| 92 | - /** |
|
| 93 | - * Returns whether verbosity is quiet (-q). |
|
| 94 | - * |
|
| 95 | - * @return bool |
|
| 96 | - */ |
|
| 97 | - public function isQuiet(): bool; |
|
| 98 | - |
|
| 99 | - /** |
|
| 100 | - * Returns whether verbosity is verbose (-v). |
|
| 101 | - * |
|
| 102 | - * @return bool |
|
| 103 | - */ |
|
| 104 | - public function isVerbose(): bool; |
|
| 105 | - |
|
| 106 | - /** |
|
| 107 | - * Returns whether verbosity is very verbose (-vv). |
|
| 108 | - * |
|
| 109 | - * @return bool |
|
| 110 | - */ |
|
| 111 | - public function isVeryVerbose(): bool; |
|
| 112 | - |
|
| 113 | - /** |
|
| 114 | - * Returns whether verbosity is debug (-vvv). |
|
| 115 | - * |
|
| 116 | - * @return bool |
|
| 117 | - */ |
|
| 118 | - public function isDebug(): bool; |
|
| 32 | + // Output formatter |
|
| 33 | + public const OUTPUT_NORMAL = 1; |
|
| 34 | + public const OUTPUT_RAW = 2; |
|
| 35 | + public const OUTPUT_PLAIN = 3; |
|
| 36 | + |
|
| 37 | + // Output verbose |
|
| 38 | + public const VERBOSITY_QUIET = 16; |
|
| 39 | + public const VERBOSITY_NORMAL = 32; |
|
| 40 | + public const VERBOSITY_VERBOSE = 64; |
|
| 41 | + public const VERBOSITY_VERY_VERBOSE = 128; |
|
| 42 | + public const VERBOSITY_DEBUG = 256; |
|
| 119 | 43 | |
| 120 | 44 | /** |
| 121 | - * Outputs a string to the cli. If you send an array it will implode them |
|
| 122 | - * with a line break. |
|
| 123 | - * |
|
| 124 | - * @param string|iterable $messages The text to output, or array of lines |
|
| 125 | - * @param bool $newline Add a newline command |
|
| 126 | - * @param int $options A bitmask of options (0 is considered the same as self::OUTPUT_NORMAL) |
|
| 127 | - * |
|
| 128 | - * @return string |
|
| 129 | - */ |
|
| 130 | - public function write($messages, bool $newline = false, int $options = 0); |
|
| 45 | + * Gets the decorated flag. |
|
| 46 | + * |
|
| 47 | + * @return bool |
|
| 48 | + */ |
|
| 49 | + public function getDecorated(): bool; |
|
| 131 | 50 | |
| 132 | 51 | /** |
| 133 | - * Writes a message to the output and adds a newline at the end. |
|
| 134 | - * |
|
| 135 | - * @param string|iterable $messages The message as an iterable of strings or a single string |
|
| 136 | - * @param int $options A bitmask of options (0 is considered the same as self::OUTPUT_NORMAL) |
|
| 137 | - * |
|
| 138 | - * @return string |
|
| 139 | - */ |
|
| 140 | - public function writeln($messages, int $options = 0); |
|
| 141 | - |
|
| 142 | - /** |
|
| 143 | - * Writes a string formatting for stantard output. |
|
| 144 | - * |
|
| 145 | - * @param string $message |
|
| 146 | - * @param string|null $style |
|
| 147 | - * |
|
| 148 | - * @return void |
|
| 149 | - */ |
|
| 150 | - public function commandline(string $message, string $style = null); |
|
| 52 | + * Sets the decorated flag. |
|
| 53 | + * |
|
| 54 | + * @param bool $decorated Whether to decorated messages |
|
| 55 | + * |
|
| 56 | + * @return void |
|
| 57 | + */ |
|
| 58 | + public function setDecorated(bool $decorated): void; |
|
| 59 | + |
|
| 60 | + /** |
|
| 61 | + * Returns a output formatter instance. |
|
| 62 | + * |
|
| 63 | + * @return \Syscodes\Components\Contracts\Console\Output\OutputFormatter |
|
| 64 | + */ |
|
| 65 | + public function getFormatter(); |
|
| 66 | + |
|
| 67 | + /** |
|
| 68 | + * Sets a output formatter instance. |
|
| 69 | + * |
|
| 70 | + * @param \Syscodes\Components\Contracts\Console\Output\OutputFormatter $formatter; |
|
| 71 | + * |
|
| 72 | + * @return void |
|
| 73 | + */ |
|
| 74 | + public function setFormatter(OutputFormatterInterface $formatter): void; |
|
| 75 | + |
|
| 76 | + /** |
|
| 77 | + * Gets the current verbosity of the output. |
|
| 78 | + * |
|
| 79 | + * @return int |
|
| 80 | + */ |
|
| 81 | + public function getVerbosity(): int; |
|
| 82 | + |
|
| 83 | + /** |
|
| 84 | + * Sets the verbosity of the output. |
|
| 85 | + * |
|
| 86 | + * @param int $level |
|
| 87 | + * |
|
| 88 | + * @return void |
|
| 89 | + */ |
|
| 90 | + public function setVerbosity(int $level): void; |
|
| 91 | + |
|
| 92 | + /** |
|
| 93 | + * Returns whether verbosity is quiet (-q). |
|
| 94 | + * |
|
| 95 | + * @return bool |
|
| 96 | + */ |
|
| 97 | + public function isQuiet(): bool; |
|
| 98 | + |
|
| 99 | + /** |
|
| 100 | + * Returns whether verbosity is verbose (-v). |
|
| 101 | + * |
|
| 102 | + * @return bool |
|
| 103 | + */ |
|
| 104 | + public function isVerbose(): bool; |
|
| 105 | + |
|
| 106 | + /** |
|
| 107 | + * Returns whether verbosity is very verbose (-vv). |
|
| 108 | + * |
|
| 109 | + * @return bool |
|
| 110 | + */ |
|
| 111 | + public function isVeryVerbose(): bool; |
|
| 112 | + |
|
| 113 | + /** |
|
| 114 | + * Returns whether verbosity is debug (-vvv). |
|
| 115 | + * |
|
| 116 | + * @return bool |
|
| 117 | + */ |
|
| 118 | + public function isDebug(): bool; |
|
| 119 | + |
|
| 120 | + /** |
|
| 121 | + * Outputs a string to the cli. If you send an array it will implode them |
|
| 122 | + * with a line break. |
|
| 123 | + * |
|
| 124 | + * @param string|iterable $messages The text to output, or array of lines |
|
| 125 | + * @param bool $newline Add a newline command |
|
| 126 | + * @param int $options A bitmask of options (0 is considered the same as self::OUTPUT_NORMAL) |
|
| 127 | + * |
|
| 128 | + * @return string |
|
| 129 | + */ |
|
| 130 | + public function write($messages, bool $newline = false, int $options = 0); |
|
| 131 | + |
|
| 132 | + /** |
|
| 133 | + * Writes a message to the output and adds a newline at the end. |
|
| 134 | + * |
|
| 135 | + * @param string|iterable $messages The message as an iterable of strings or a single string |
|
| 136 | + * @param int $options A bitmask of options (0 is considered the same as self::OUTPUT_NORMAL) |
|
| 137 | + * |
|
| 138 | + * @return string |
|
| 139 | + */ |
|
| 140 | + public function writeln($messages, int $options = 0); |
|
| 141 | + |
|
| 142 | + /** |
|
| 143 | + * Writes a string formatting for stantard output. |
|
| 144 | + * |
|
| 145 | + * @param string $message |
|
| 146 | + * @param string|null $style |
|
| 147 | + * |
|
| 148 | + * @return void |
|
| 149 | + */ |
|
| 150 | + public function commandline(string $message, string $style = null); |
|
| 151 | 151 | } |
| 152 | 152 | \ No newline at end of file |
@@ -28,13 +28,13 @@ |
||
| 28 | 28 | interface OutputStyle |
| 29 | 29 | { |
| 30 | 30 | /** |
| 31 | - * Enter a number of empty lines. |
|
| 32 | - * |
|
| 33 | - * @param int $num Number of lines to output |
|
| 34 | - * |
|
| 35 | - * @return string |
|
| 36 | - */ |
|
| 37 | - public function newline(int $num = 1); |
|
| 31 | + * Enter a number of empty lines. |
|
| 32 | + * |
|
| 33 | + * @param int $num Number of lines to output |
|
| 34 | + * |
|
| 35 | + * @return string |
|
| 36 | + */ |
|
| 37 | + public function newline(int $num = 1); |
|
| 38 | 38 | |
| 39 | 39 | /** |
| 40 | 40 | * Writes a string formatting for comment output. |
@@ -48,7 +48,7 @@ |
||
| 48 | 48 | * Shutdown the application. |
| 49 | 49 | * |
| 50 | 50 | * @param \Syscodes\Components\Contracts\Console\Input\Input $input |
| 51 | - * @param int $status |
|
| 51 | + * @param int $status |
|
| 52 | 52 | * |
| 53 | 53 | * @return void |
| 54 | 54 | */ |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | * |
| 59 | 59 | * @return bool |
| 60 | 60 | */ |
| 61 | - public function hasParameterOption(string|array $values, bool $params = false): bool; |
|
| 61 | + public function hasParameterOption(string | array $values, bool $params = false): bool; |
|
| 62 | 62 | |
| 63 | 63 | /** |
| 64 | 64 | * Gets the value of a unprocessed option (not parsed). |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | * |
| 70 | 70 | * @return mixed |
| 71 | 71 | */ |
| 72 | - public function getParameterOption(string|array $values, $default = false, bool $params = false): mixed; |
|
| 72 | + public function getParameterOption(string | array $values, $default = false, bool $params = false): mixed; |
|
| 73 | 73 | |
| 74 | 74 | /** |
| 75 | 75 | * Get the input interactive. |
@@ -49,28 +49,28 @@ |
||
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | /** |
| 52 | - * Parse the given URI. |
|
| 53 | - * |
|
| 54 | - * @param string $uri |
|
| 55 | - * |
|
| 56 | - * @return static |
|
| 57 | - */ |
|
| 58 | - public static function parse(string $uri): static |
|
| 59 | - { |
|
| 60 | - preg_match_all('~\{([\w\:]+?)\??\}~', $uri, $matches); |
|
| 52 | + * Parse the given URI. |
|
| 53 | + * |
|
| 54 | + * @param string $uri |
|
| 55 | + * |
|
| 56 | + * @return static |
|
| 57 | + */ |
|
| 58 | + public static function parse(string $uri): static |
|
| 59 | + { |
|
| 60 | + preg_match_all('~\{([\w\:]+?)\??\}~', $uri, $matches); |
|
| 61 | 61 | |
| 62 | - foreach ($matches[0] as $match) { |
|
| 63 | - if ( ! Str::contains($match, ':')) { |
|
| 64 | - continue; |
|
| 65 | - } |
|
| 62 | + foreach ($matches[0] as $match) { |
|
| 63 | + if ( ! Str::contains($match, ':')) { |
|
| 64 | + continue; |
|
| 65 | + } |
|
| 66 | 66 | |
| 67 | - $segments = explode(':', trim($match, '{}?')); |
|
| 67 | + $segments = explode(':', trim($match, '{}?')); |
|
| 68 | 68 | |
| 69 | - $uri = Str::contains($match, '?') |
|
| 69 | + $uri = Str::contains($match, '?') |
|
| 70 | 70 | ? str_replace($match, '{'.$segments[0].'?}', $uri) |
| 71 | 71 | : str_replace($match, '{'.$segments[0].'}', $uri); |
| 72 | - } |
|
| 72 | + } |
|
| 73 | 73 | |
| 74 | - return new static($uri); |
|
| 75 | - } |
|
| 74 | + return new static($uri); |
|
| 75 | + } |
|
| 76 | 76 | } |
| 77 | 77 | \ No newline at end of file |
@@ -339,7 +339,7 @@ |
||
| 339 | 339 | */ |
| 340 | 340 | protected function getNestedResourceUri(array $segments): string |
| 341 | 341 | { |
| 342 | - return implode('/', array_map(function ($segment) { |
|
| 342 | + return implode('/', array_map(function($segment) { |
|
| 343 | 343 | return $segment.'/{'.$this->getResourceWilcard($segment).'}'; |
| 344 | 344 | }, $segments)); |
| 345 | 345 | } |