@@ -69,10 +69,10 @@ discard block |
||
| 69 | 69 | |
| 70 | 70 | /** |
| 71 | 71 | * Sets the decorated flag. |
| 72 | - * |
|
| 73 | - * @param bool $decorated Whether to decorated messages |
|
| 74 | - * |
|
| 75 | - * @return void |
|
| 72 | + * |
|
| 73 | + * @param bool $decorated Whether to decorated messages |
|
| 74 | + * |
|
| 75 | + * @return void |
|
| 76 | 76 | */ |
| 77 | 77 | public function setDecorated(bool $decorated): void |
| 78 | 78 | { |
@@ -83,10 +83,10 @@ discard block |
||
| 83 | 83 | |
| 84 | 84 | /** |
| 85 | 85 | * Sets a output formatter instance. |
| 86 | - * |
|
| 87 | - * @param \Syscodes\Components\Contracts\Console\Output\OutputFormatter $formatter; |
|
| 88 | - * |
|
| 89 | - * @return void |
|
| 86 | + * |
|
| 87 | + * @param \Syscodes\Components\Contracts\Console\Output\OutputFormatter $formatter; |
|
| 88 | + * |
|
| 89 | + * @return void |
|
| 90 | 90 | */ |
| 91 | 91 | public function setFormatter(OutputFormatterInterface $formatter): void |
| 92 | 92 | { |
@@ -97,10 +97,10 @@ discard block |
||
| 97 | 97 | |
| 98 | 98 | /** |
| 99 | 99 | * Sets the verbosity of the output. |
| 100 | - * |
|
| 101 | - * @param int $level |
|
| 102 | - * |
|
| 103 | - * @return void |
|
| 100 | + * |
|
| 101 | + * @param int $level |
|
| 102 | + * |
|
| 103 | + * @return void |
|
| 104 | 104 | */ |
| 105 | 105 | public function setVerbosity(int $level): void |
| 106 | 106 | { |
@@ -33,215 +33,215 @@ |
||
| 33 | 33 | */ |
| 34 | 34 | abstract class Output implements OutputInterface |
| 35 | 35 | { |
| 36 | - use InteractsIO; |
|
| 37 | - |
|
| 38 | - /** |
|
| 39 | - * Gets formatter for output console. |
|
| 40 | - * |
|
| 41 | - * @var \Syscodes\Components\Contracts\Console\Output\OutputFormatter $formatter |
|
| 42 | - */ |
|
| 43 | - protected $formatter; |
|
| 44 | - |
|
| 45 | - /** |
|
| 46 | - * Gets the verbosity level. |
|
| 47 | - * |
|
| 48 | - * @var int $verbosity |
|
| 49 | - */ |
|
| 50 | - protected $verbosity; |
|
| 51 | - |
|
| 52 | - /** |
|
| 53 | - * Constructor. Create a new Output instance. |
|
| 54 | - * |
|
| 55 | - * @param int|null $verbosity The verbosity level |
|
| 56 | - * @param bool $decorated Whether to decorated messages |
|
| 57 | - * @param \Syscodes\Components\Contracts\Console\Output\OutputFormatter|null $formatter The output formatter instance |
|
| 58 | - * |
|
| 59 | - * @return void |
|
| 60 | - */ |
|
| 61 | - public function __construct(?int $verbosity = OutputInterface::VERBOSITY_NORMAL, bool $decorated = false, OutputFormatterInterface $formatter = null) |
|
| 62 | - { |
|
| 63 | - $this->verbosity = $verbosity ?? OutputInterface::VERBOSITY_NORMAL; |
|
| 64 | - $this->formatter = $formatter ?? new OutputFormatter(); |
|
| 36 | + use InteractsIO; |
|
| 37 | + |
|
| 38 | + /** |
|
| 39 | + * Gets formatter for output console. |
|
| 40 | + * |
|
| 41 | + * @var \Syscodes\Components\Contracts\Console\Output\OutputFormatter $formatter |
|
| 42 | + */ |
|
| 43 | + protected $formatter; |
|
| 44 | + |
|
| 45 | + /** |
|
| 46 | + * Gets the verbosity level. |
|
| 47 | + * |
|
| 48 | + * @var int $verbosity |
|
| 49 | + */ |
|
| 50 | + protected $verbosity; |
|
| 51 | + |
|
| 52 | + /** |
|
| 53 | + * Constructor. Create a new Output instance. |
|
| 54 | + * |
|
| 55 | + * @param int|null $verbosity The verbosity level |
|
| 56 | + * @param bool $decorated Whether to decorated messages |
|
| 57 | + * @param \Syscodes\Components\Contracts\Console\Output\OutputFormatter|null $formatter The output formatter instance |
|
| 58 | + * |
|
| 59 | + * @return void |
|
| 60 | + */ |
|
| 61 | + public function __construct(?int $verbosity = OutputInterface::VERBOSITY_NORMAL, bool $decorated = false, OutputFormatterInterface $formatter = null) |
|
| 62 | + { |
|
| 63 | + $this->verbosity = $verbosity ?? OutputInterface::VERBOSITY_NORMAL; |
|
| 64 | + $this->formatter = $formatter ?? new OutputFormatter(); |
|
| 65 | 65 | |
| 66 | - $this->formatter->setDecorated($decorated); |
|
| 67 | - } |
|
| 68 | - |
|
| 69 | - /** |
|
| 70 | - * Gets the decorated flag. |
|
| 71 | - * |
|
| 72 | - * @return bool |
|
| 73 | - */ |
|
| 74 | - public function getDecorated(): bool |
|
| 75 | - { |
|
| 76 | - return $this->formatter->getDecorated(); |
|
| 77 | - } |
|
| 78 | - |
|
| 79 | - /** |
|
| 80 | - * Sets the decorated flag. |
|
| 81 | - * |
|
| 82 | - * @param bool $decorated Whether to decorated messages |
|
| 83 | - * |
|
| 84 | - * @return void |
|
| 85 | - */ |
|
| 86 | - public function setDecorated(bool $decorated): void |
|
| 87 | - { |
|
| 88 | - $this->formatter->setDecorated($decorated); |
|
| 89 | - } |
|
| 90 | - |
|
| 91 | - /** |
|
| 92 | - * Returns a output formatter instance. |
|
| 93 | - * |
|
| 94 | - * @return \Syscodes\Components\Contracts\Console\Output\OutputFormatter |
|
| 95 | - */ |
|
| 96 | - public function getFormatter(): OutputFormatterInterface |
|
| 97 | - { |
|
| 98 | - return $this->formatter; |
|
| 99 | - } |
|
| 100 | - |
|
| 101 | - /** |
|
| 102 | - * Sets a output formatter instance. |
|
| 103 | - * |
|
| 104 | - * @param \Syscodes\Components\Contracts\Console\Output\OutputFormatter $formatter; |
|
| 105 | - * |
|
| 106 | - * @return void |
|
| 107 | - */ |
|
| 108 | - public function setFormatter(OutputFormatterInterface $formatter): void |
|
| 109 | - { |
|
| 110 | - $this->formatter = $formatter; |
|
| 111 | - } |
|
| 112 | - |
|
| 113 | - /** |
|
| 114 | - * Gets the current verbosity of the output. |
|
| 115 | - * |
|
| 116 | - * @return int |
|
| 117 | - */ |
|
| 118 | - public function getVerbosity(): int |
|
| 119 | - { |
|
| 120 | - return $this->verbosity; |
|
| 121 | - } |
|
| 122 | - |
|
| 123 | - /** |
|
| 124 | - * Sets the verbosity of the output. |
|
| 125 | - * |
|
| 126 | - * @param int $level |
|
| 127 | - * |
|
| 128 | - * @return void |
|
| 129 | - */ |
|
| 130 | - public function setVerbosity(int $level): void |
|
| 131 | - { |
|
| 132 | - $this->verbosity = $level; |
|
| 133 | - } |
|
| 134 | - |
|
| 135 | - /** |
|
| 136 | - * Returns whether verbosity is quiet (-q). |
|
| 137 | - * |
|
| 138 | - * @return bool |
|
| 139 | - */ |
|
| 140 | - public function isQuiet(): bool |
|
| 141 | - { |
|
| 142 | - return OutputInterface::VERBOSITY_QUIET === $this->verbosity; |
|
| 143 | - } |
|
| 144 | - |
|
| 145 | - /** |
|
| 146 | - * Returns whether verbosity is verbose (-v). |
|
| 147 | - * |
|
| 148 | - * @return bool |
|
| 149 | - */ |
|
| 150 | - public function isVerbose(): bool |
|
| 151 | - { |
|
| 152 | - return OutputInterface::VERBOSITY_VERBOSE <= $this->verbosity; |
|
| 153 | - } |
|
| 154 | - |
|
| 155 | - /** |
|
| 156 | - * Returns whether verbosity is very verbose (-vv). |
|
| 157 | - * |
|
| 158 | - * @return bool |
|
| 159 | - */ |
|
| 160 | - public function isVeryVerbose(): bool |
|
| 161 | - { |
|
| 162 | - return OutputInterface::VERBOSITY_VERY_VERBOSE <= $this->verbosity; |
|
| 163 | - } |
|
| 164 | - |
|
| 165 | - /** |
|
| 166 | - * Returns whether verbosity is debug (-vvv). |
|
| 167 | - * |
|
| 168 | - * @return bool |
|
| 169 | - */ |
|
| 170 | - public function isDebug(): bool |
|
| 171 | - { |
|
| 172 | - return OutputInterface::VERBOSITY_QUIET <= $this->verbosity; |
|
| 173 | - } |
|
| 174 | - |
|
| 175 | - /** |
|
| 176 | - * Enter a number of empty lines. |
|
| 177 | - * |
|
| 178 | - * @param int $num Number of lines to output |
|
| 179 | - * |
|
| 180 | - * @return string |
|
| 181 | - */ |
|
| 182 | - public function newLine(int $num = 1) |
|
| 183 | - { |
|
| 184 | - return $this->write(str_repeat(\PHP_EOL, max($num, 1))); |
|
| 185 | - } |
|
| 186 | - |
|
| 187 | - /** |
|
| 188 | - * Writes a message to the output and adds a newline at the end. |
|
| 189 | - * |
|
| 190 | - * @param string|iterable $messages The message as an iterable of strings or a single string |
|
| 191 | - * @param int $options A bitmask of options (0 is considered the same as self::OUTPUT_NORMAL) |
|
| 192 | - * |
|
| 193 | - * @return string |
|
| 194 | - */ |
|
| 195 | - public function writeln($messages, int $options = OutputInterface::OUTPUT_NORMAL) |
|
| 196 | - { |
|
| 197 | - return $this->write($messages, true, $options); |
|
| 198 | - } |
|
| 199 | - |
|
| 200 | - /** |
|
| 201 | - * Outputs a string to the cli. If you send an array it will implode them |
|
| 202 | - * with a line break. |
|
| 203 | - * |
|
| 204 | - * @param string|iterable $messages The text to output, or array of lines |
|
| 205 | - * @param bool $newline Add a newline command |
|
| 206 | - * @param int $options A bitmask of options (0 is considered the same as self::OUTPUT_NORMAL) |
|
| 207 | - * |
|
| 208 | - * @return string |
|
| 209 | - */ |
|
| 210 | - public function write($messages, bool $newline = false, int $options = OutputInterface::OUTPUT_NORMAL) |
|
| 211 | - { |
|
| 212 | - if ( ! is_iterable($messages)) { |
|
| 213 | - $messages = [$messages]; |
|
| 214 | - } |
|
| 66 | + $this->formatter->setDecorated($decorated); |
|
| 67 | + } |
|
| 68 | + |
|
| 69 | + /** |
|
| 70 | + * Gets the decorated flag. |
|
| 71 | + * |
|
| 72 | + * @return bool |
|
| 73 | + */ |
|
| 74 | + public function getDecorated(): bool |
|
| 75 | + { |
|
| 76 | + return $this->formatter->getDecorated(); |
|
| 77 | + } |
|
| 78 | + |
|
| 79 | + /** |
|
| 80 | + * Sets the decorated flag. |
|
| 81 | + * |
|
| 82 | + * @param bool $decorated Whether to decorated messages |
|
| 83 | + * |
|
| 84 | + * @return void |
|
| 85 | + */ |
|
| 86 | + public function setDecorated(bool $decorated): void |
|
| 87 | + { |
|
| 88 | + $this->formatter->setDecorated($decorated); |
|
| 89 | + } |
|
| 90 | + |
|
| 91 | + /** |
|
| 92 | + * Returns a output formatter instance. |
|
| 93 | + * |
|
| 94 | + * @return \Syscodes\Components\Contracts\Console\Output\OutputFormatter |
|
| 95 | + */ |
|
| 96 | + public function getFormatter(): OutputFormatterInterface |
|
| 97 | + { |
|
| 98 | + return $this->formatter; |
|
| 99 | + } |
|
| 100 | + |
|
| 101 | + /** |
|
| 102 | + * Sets a output formatter instance. |
|
| 103 | + * |
|
| 104 | + * @param \Syscodes\Components\Contracts\Console\Output\OutputFormatter $formatter; |
|
| 105 | + * |
|
| 106 | + * @return void |
|
| 107 | + */ |
|
| 108 | + public function setFormatter(OutputFormatterInterface $formatter): void |
|
| 109 | + { |
|
| 110 | + $this->formatter = $formatter; |
|
| 111 | + } |
|
| 112 | + |
|
| 113 | + /** |
|
| 114 | + * Gets the current verbosity of the output. |
|
| 115 | + * |
|
| 116 | + * @return int |
|
| 117 | + */ |
|
| 118 | + public function getVerbosity(): int |
|
| 119 | + { |
|
| 120 | + return $this->verbosity; |
|
| 121 | + } |
|
| 122 | + |
|
| 123 | + /** |
|
| 124 | + * Sets the verbosity of the output. |
|
| 125 | + * |
|
| 126 | + * @param int $level |
|
| 127 | + * |
|
| 128 | + * @return void |
|
| 129 | + */ |
|
| 130 | + public function setVerbosity(int $level): void |
|
| 131 | + { |
|
| 132 | + $this->verbosity = $level; |
|
| 133 | + } |
|
| 134 | + |
|
| 135 | + /** |
|
| 136 | + * Returns whether verbosity is quiet (-q). |
|
| 137 | + * |
|
| 138 | + * @return bool |
|
| 139 | + */ |
|
| 140 | + public function isQuiet(): bool |
|
| 141 | + { |
|
| 142 | + return OutputInterface::VERBOSITY_QUIET === $this->verbosity; |
|
| 143 | + } |
|
| 144 | + |
|
| 145 | + /** |
|
| 146 | + * Returns whether verbosity is verbose (-v). |
|
| 147 | + * |
|
| 148 | + * @return bool |
|
| 149 | + */ |
|
| 150 | + public function isVerbose(): bool |
|
| 151 | + { |
|
| 152 | + return OutputInterface::VERBOSITY_VERBOSE <= $this->verbosity; |
|
| 153 | + } |
|
| 154 | + |
|
| 155 | + /** |
|
| 156 | + * Returns whether verbosity is very verbose (-vv). |
|
| 157 | + * |
|
| 158 | + * @return bool |
|
| 159 | + */ |
|
| 160 | + public function isVeryVerbose(): bool |
|
| 161 | + { |
|
| 162 | + return OutputInterface::VERBOSITY_VERY_VERBOSE <= $this->verbosity; |
|
| 163 | + } |
|
| 164 | + |
|
| 165 | + /** |
|
| 166 | + * Returns whether verbosity is debug (-vvv). |
|
| 167 | + * |
|
| 168 | + * @return bool |
|
| 169 | + */ |
|
| 170 | + public function isDebug(): bool |
|
| 171 | + { |
|
| 172 | + return OutputInterface::VERBOSITY_QUIET <= $this->verbosity; |
|
| 173 | + } |
|
| 174 | + |
|
| 175 | + /** |
|
| 176 | + * Enter a number of empty lines. |
|
| 177 | + * |
|
| 178 | + * @param int $num Number of lines to output |
|
| 179 | + * |
|
| 180 | + * @return string |
|
| 181 | + */ |
|
| 182 | + public function newLine(int $num = 1) |
|
| 183 | + { |
|
| 184 | + return $this->write(str_repeat(\PHP_EOL, max($num, 1))); |
|
| 185 | + } |
|
| 186 | + |
|
| 187 | + /** |
|
| 188 | + * Writes a message to the output and adds a newline at the end. |
|
| 189 | + * |
|
| 190 | + * @param string|iterable $messages The message as an iterable of strings or a single string |
|
| 191 | + * @param int $options A bitmask of options (0 is considered the same as self::OUTPUT_NORMAL) |
|
| 192 | + * |
|
| 193 | + * @return string |
|
| 194 | + */ |
|
| 195 | + public function writeln($messages, int $options = OutputInterface::OUTPUT_NORMAL) |
|
| 196 | + { |
|
| 197 | + return $this->write($messages, true, $options); |
|
| 198 | + } |
|
| 199 | + |
|
| 200 | + /** |
|
| 201 | + * Outputs a string to the cli. If you send an array it will implode them |
|
| 202 | + * with a line break. |
|
| 203 | + * |
|
| 204 | + * @param string|iterable $messages The text to output, or array of lines |
|
| 205 | + * @param bool $newline Add a newline command |
|
| 206 | + * @param int $options A bitmask of options (0 is considered the same as self::OUTPUT_NORMAL) |
|
| 207 | + * |
|
| 208 | + * @return string |
|
| 209 | + */ |
|
| 210 | + public function write($messages, bool $newline = false, int $options = OutputInterface::OUTPUT_NORMAL) |
|
| 211 | + { |
|
| 212 | + if ( ! is_iterable($messages)) { |
|
| 213 | + $messages = [$messages]; |
|
| 214 | + } |
|
| 215 | 215 | |
| 216 | - $types = OutputInterface::OUTPUT_NORMAL | OutputInterface::OUTPUT_RAW | OutputInterface::OUTPUT_PLAIN; |
|
| 217 | - $type = $types & $options ?: OutputInterface::OUTPUT_NORMAL; |
|
| 216 | + $types = OutputInterface::OUTPUT_NORMAL | OutputInterface::OUTPUT_RAW | OutputInterface::OUTPUT_PLAIN; |
|
| 217 | + $type = $types & $options ?: OutputInterface::OUTPUT_NORMAL; |
|
| 218 | 218 | |
| 219 | - $verbosities = OutputInterface::VERBOSITY_QUIET | OutputInterface::VERBOSITY_NORMAL | OutputInterface::VERBOSITY_VERBOSE | OutputInterface::VERBOSITY_VERY_VERBOSE | OutputInterface::VERBOSITY_DEBUG; |
|
| 219 | + $verbosities = OutputInterface::VERBOSITY_QUIET | OutputInterface::VERBOSITY_NORMAL | OutputInterface::VERBOSITY_VERBOSE | OutputInterface::VERBOSITY_VERY_VERBOSE | OutputInterface::VERBOSITY_DEBUG; |
|
| 220 | 220 | |
| 221 | - $verbosity = $verbosities & $options ?: OutputInterface::VERBOSITY_NORMAL; |
|
| 221 | + $verbosity = $verbosities & $options ?: OutputInterface::VERBOSITY_NORMAL; |
|
| 222 | 222 | |
| 223 | - if ($verbosity > $this->getVerbosity()) { |
|
| 224 | - return; |
|
| 225 | - } |
|
| 223 | + if ($verbosity > $this->getVerbosity()) { |
|
| 224 | + return; |
|
| 225 | + } |
|
| 226 | 226 | |
| 227 | - foreach ($messages as $message) { |
|
| 228 | - match ($type) { |
|
| 229 | - OutputInterface::OUTPUT_NORMAL => $message = $this->formatter->format($message), |
|
| 230 | - OutputInterface::OUTPUT_RAW, |
|
| 231 | - OutputInterface::OUTPUT_PLAIN => $message = strip_tags($this->formatter->format($message)), |
|
| 232 | - }; |
|
| 233 | - } |
|
| 227 | + foreach ($messages as $message) { |
|
| 228 | + match ($type) { |
|
| 229 | + OutputInterface::OUTPUT_NORMAL => $message = $this->formatter->format($message), |
|
| 230 | + OutputInterface::OUTPUT_RAW, |
|
| 231 | + OutputInterface::OUTPUT_PLAIN => $message = strip_tags($this->formatter->format($message)), |
|
| 232 | + }; |
|
| 233 | + } |
|
| 234 | 234 | |
| 235 | - $this->toWrite($message ?? '', $newline); |
|
| 236 | - } |
|
| 237 | - |
|
| 238 | - /** |
|
| 239 | - * Writes a message to the output. |
|
| 240 | - * |
|
| 241 | - * @param string $message The text to output |
|
| 242 | - * @param bool $newline Add a newline command |
|
| 243 | - * |
|
| 244 | - * @return void |
|
| 245 | - */ |
|
| 246 | - abstract protected function toWrite(string $message, bool $newline): void; |
|
| 235 | + $this->toWrite($message ?? '', $newline); |
|
| 236 | + } |
|
| 237 | + |
|
| 238 | + /** |
|
| 239 | + * Writes a message to the output. |
|
| 240 | + * |
|
| 241 | + * @param string $message The text to output |
|
| 242 | + * @param bool $newline Add a newline command |
|
| 243 | + * |
|
| 244 | + * @return void |
|
| 245 | + */ |
|
| 246 | + abstract protected function toWrite(string $message, bool $newline): void; |
|
| 247 | 247 | } |
| 248 | 248 | \ No newline at end of file |
@@ -128,7 +128,7 @@ |
||
| 128 | 128 | */ |
| 129 | 129 | public function getStyle(string $name): string |
| 130 | 130 | { |
| 131 | - if (!$this->hasStyle($name)) { |
|
| 131 | + if ( ! $this->hasStyle($name)) { |
|
| 132 | 132 | throw new InvalidArgumentException('Undefined style: '.$name); |
| 133 | 133 | } |
| 134 | 134 | |
@@ -74,7 +74,7 @@ |
||
| 74 | 74 | * |
| 75 | 75 | * @return \Syscodes\Components\Console\Formatter\OutputFormatterStyle |
| 76 | 76 | */ |
| 77 | - public function push(OutputFormatterStyleInterface $style = null) |
|
| 77 | + public function push(OutputFormatterStyleInterface $style = null) |
|
| 78 | 78 | { |
| 79 | 79 | $this->styles[] = $style; |
| 80 | 80 | } |
@@ -49,7 +49,7 @@ |
||
| 49 | 49 | * Constructor. Create a new Interactor instance. |
| 50 | 50 | * |
| 51 | 51 | * @param \Syscodes\Components\Contracts\Console\Input\Input|null $input The input interface implemented |
| 52 | - * @param \Syscodes\Components\Contracts\Console\Output\Output|null $output The output interface implemented |
|
| 52 | + * @param \Syscodes\Components\Contracts\Console\Output\Output|null $output The output interface implemented |
|
| 53 | 53 | * |
| 54 | 54 | * @return void |
| 55 | 55 | */ |
@@ -54,11 +54,11 @@ discard block |
||
| 54 | 54 | */ |
| 55 | 55 | protected static $defaultName; |
| 56 | 56 | |
| 57 | - /** |
|
| 58 | - * The default command description. |
|
| 59 | - * |
|
| 60 | - * @var string|null $defaultDescription |
|
| 61 | - */ |
|
| 57 | + /** |
|
| 58 | + * The default command description. |
|
| 59 | + * |
|
| 60 | + * @var string|null $defaultDescription |
|
| 61 | + */ |
|
| 62 | 62 | protected static $defaultDescription; |
| 63 | 63 | |
| 64 | 64 | /** |
@@ -436,9 +436,9 @@ discard block |
||
| 436 | 436 | */ |
| 437 | 437 | public function setApplication(Application $application = null): static |
| 438 | 438 | { |
| 439 | - $this->application = $application; |
|
| 439 | + $this->application = $application; |
|
| 440 | 440 | |
| 441 | - return $this; |
|
| 441 | + return $this; |
|
| 442 | 442 | } |
| 443 | 443 | |
| 444 | 444 | /** |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | * |
| 83 | 83 | * @return bool |
| 84 | 84 | */ |
| 85 | - public function hasParameterOption(string|array $values, bool $params = false): bool |
|
| 85 | + public function hasParameterOption(string | array $values, bool $params = false): bool |
|
| 86 | 86 | { |
| 87 | 87 | foreach ($this->parameters as $key => $value) { |
| 88 | 88 | if ( ! is_int($key)) { |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | * |
| 111 | 111 | * @return mixed |
| 112 | 112 | */ |
| 113 | - public function getParameterOption(string|array $values, mixed $default = false, bool $params = false): mixed |
|
| 113 | + public function getParameterOption(string | array $values, mixed $default = false, bool $params = false): mixed |
|
| 114 | 114 | { |
| 115 | 115 | foreach ($this->parameters as $key => $value) { |
| 116 | 116 | if ($params && ('--' === $key || (is_int($key) && '--' === $value))) { |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | $len = strlen($name); |
| 137 | 137 | |
| 138 | 138 | for ($i = 0; $i < $len; $i++) { |
| 139 | - if (!$this->definition->hasShortcut($name[$i])) { |
|
| 139 | + if ( ! $this->definition->hasShortcut($name[$i])) { |
|
| 140 | 140 | throw new RuntimeException(sprintf('The "-%s" option does not exist', $name[$i])); |
| 141 | 141 | } |
| 142 | 142 | |
@@ -249,7 +249,7 @@ discard block |
||
| 249 | 249 | * |
| 250 | 250 | * @return bool |
| 251 | 251 | */ |
| 252 | - public function hasParameterOption(string|array $values, bool $params = false): bool |
|
| 252 | + public function hasParameterOption(string | array $values, bool $params = false): bool |
|
| 253 | 253 | { |
| 254 | 254 | $tokens = $this->getTokens(); |
| 255 | 255 | |
@@ -278,7 +278,7 @@ discard block |
||
| 278 | 278 | * |
| 279 | 279 | * @return mixed |
| 280 | 280 | */ |
| 281 | - public function getParameterOption(string|array $values, $default = false, bool $params = false): mixed |
|
| 281 | + public function getParameterOption(string | array $values, $default = false, bool $params = false): mixed |
|
| 282 | 282 | { |
| 283 | 283 | $tokens = $this->getTokens(); |
| 284 | 284 | |
@@ -324,7 +324,7 @@ discard block |
||
| 324 | 324 | { |
| 325 | 325 | $self = $this; |
| 326 | 326 | |
| 327 | - $tokens = array_map(function ($token) use ($self) { |
|
| 327 | + $tokens = array_map(function($token) use ($self) { |
|
| 328 | 328 | if (preg_match('{^(-[^=]+=)(.+)}', $token, $match)) { |
| 329 | 329 | return $match[1].$self->escapeToken($match[2]); |
| 330 | 330 | } |
@@ -268,7 +268,7 @@ |
||
| 268 | 268 | * |
| 269 | 269 | * @return string |
| 270 | 270 | */ |
| 271 | - private static function determinePrefix(Route $route,array $tokens): string |
|
| 271 | + private static function determinePrefix(Route $route, array $tokens): string |
|
| 272 | 272 | { |
| 273 | 273 | if ('text' !== $tokens[0][0]) { |
| 274 | 274 | return ($route->hasDefault($tokens[0][3]) || '/' === $tokens[0][1]) ? '' : $tokens[0][1]; |