@@ -274,7 +274,7 @@ |
||
| 274 | 274 | $j = (($uchr[1] - 224) << 12) + (($uchr[2] - 128) << 6) + $uchr[3] - 0xAC80; |
| 275 | 275 | |
| 276 | 276 | $uchr = "\xE1\x84".\chr(0x80 + (int) ($j / 588)) |
| 277 | - ."\xE1\x85".\chr(0xA1 + (int) (($j % 588) / 28)); |
|
| 277 | + ."\xE1\x85".\chr(0xA1 + (int) (($j % 588) / 28)); |
|
| 278 | 278 | |
| 279 | 279 | if ($j %= 28) { |
| 280 | 280 | $uchr .= $j < 25 |
@@ -156,8 +156,8 @@ discard block |
||
| 156 | 156 | |
| 157 | 157 | $ucls = $combClass[$uchr] ?? 0; |
| 158 | 158 | |
| 159 | - if (isset($compMap[$lastUchr.$uchr]) && (!$lastUcls || $lastUcls < $ucls)) { |
|
| 160 | - $lastUchr = $compMap[$lastUchr.$uchr]; |
|
| 159 | + if (isset($compMap[$lastUchr . $uchr]) && (!$lastUcls || $lastUcls < $ucls)) { |
|
| 160 | + $lastUchr = $compMap[$lastUchr . $uchr]; |
|
| 161 | 161 | } elseif ($lastUcls = $ucls) { |
| 162 | 162 | $tail .= $uchr; |
| 163 | 163 | } else { |
@@ -185,13 +185,13 @@ discard block |
||
| 185 | 185 | } |
| 186 | 186 | |
| 187 | 187 | $L = 0xAC00 + ($L * 21 + $V) * 28 + $T; |
| 188 | - $lastUchr = \chr(0xE0 | $L >> 12).\chr(0x80 | $L >> 6 & 0x3F).\chr(0x80 | $L & 0x3F); |
|
| 188 | + $lastUchr = \chr(0xE0 | $L >> 12) . \chr(0x80 | $L >> 6 & 0x3F) . \chr(0x80 | $L & 0x3F); |
|
| 189 | 189 | } |
| 190 | 190 | |
| 191 | 191 | $i += $ulen; |
| 192 | 192 | } |
| 193 | 193 | |
| 194 | - return $result.$lastUchr.$tail; |
|
| 194 | + return $result . $lastUchr . $tail; |
|
| 195 | 195 | } |
| 196 | 196 | |
| 197 | 197 | private static function decompose($s, $c) |
@@ -246,7 +246,7 @@ discard block |
||
| 246 | 246 | $i -= $j; |
| 247 | 247 | |
| 248 | 248 | if (0 > $i) { |
| 249 | - $s = str_repeat(' ', -$i).$s; |
|
| 249 | + $s = str_repeat(' ', -$i) . $s; |
|
| 250 | 250 | $len -= $i; |
| 251 | 251 | $i = 0; |
| 252 | 252 | } |
@@ -273,13 +273,13 @@ discard block |
||
| 273 | 273 | $uchr = unpack('C*', $uchr); |
| 274 | 274 | $j = (($uchr[1] - 224) << 12) + (($uchr[2] - 128) << 6) + $uchr[3] - 0xAC80; |
| 275 | 275 | |
| 276 | - $uchr = "\xE1\x84".\chr(0x80 + (int) ($j / 588)) |
|
| 277 | - ."\xE1\x85".\chr(0xA1 + (int) (($j % 588) / 28)); |
|
| 276 | + $uchr = "\xE1\x84" . \chr(0x80 + (int) ($j / 588)) |
|
| 277 | + ."\xE1\x85" . \chr(0xA1 + (int) (($j % 588) / 28)); |
|
| 278 | 278 | |
| 279 | 279 | if ($j %= 28) { |
| 280 | 280 | $uchr .= $j < 25 |
| 281 | - ? ("\xE1\x86".\chr(0xA7 + $j)) |
|
| 282 | - : ("\xE1\x87".\chr(0x67 + $j)); |
|
| 281 | + ? ("\xE1\x86" . \chr(0xA7 + $j)) |
|
| 282 | + : ("\xE1\x87" . \chr(0x67 + $j)); |
|
| 283 | 283 | } |
| 284 | 284 | } |
| 285 | 285 | if ($c) { |
@@ -301,7 +301,7 @@ discard block |
||
| 301 | 301 | |
| 302 | 302 | private static function getData($file) |
| 303 | 303 | { |
| 304 | - if (file_exists($file = __DIR__.'/Resources/unidata/'.$file.'.php')) { |
|
| 304 | + if (file_exists($file = __DIR__ . '/Resources/unidata/' . $file . '.php')) { |
|
| 305 | 305 | return require $file; |
| 306 | 306 | } |
| 307 | 307 | |
@@ -133,11 +133,11 @@ discard block |
||
| 133 | 133 | return sprintf('!php/const %s::%s', \get_class($value), $value->name); |
| 134 | 134 | case \is_object($value): |
| 135 | 135 | if ($value instanceof TaggedValue) { |
| 136 | - return '!'.$value->getTag().' '.self::dump($value->getValue(), $flags); |
|
| 136 | + return '!' . $value->getTag() . ' ' . self::dump($value->getValue(), $flags); |
|
| 137 | 137 | } |
| 138 | 138 | |
| 139 | 139 | if (Yaml::DUMP_OBJECT & $flags) { |
| 140 | - return '!php/object '.self::dump(serialize($value)); |
|
| 140 | + return '!php/object ' . self::dump(serialize($value)); |
|
| 141 | 141 | } |
| 142 | 142 | |
| 143 | 143 | if (Yaml::DUMP_OBJECT_AS_MAP & $flags && ($value instanceof \stdClass || $value instanceof \ArrayObject)) { |
@@ -177,7 +177,7 @@ discard block |
||
| 177 | 177 | } elseif (floor($value) == $value && $repr == $value) { |
| 178 | 178 | // Preserve float data type since storing a whole number will result in integer value. |
| 179 | 179 | if (false === strpos($repr, 'E')) { |
| 180 | - $repr = $repr.'.0'; |
|
| 180 | + $repr = $repr . '.0'; |
|
| 181 | 181 | } |
| 182 | 182 | } |
| 183 | 183 | } else { |
@@ -191,7 +191,7 @@ discard block |
||
| 191 | 191 | case '' == $value: |
| 192 | 192 | return "''"; |
| 193 | 193 | case self::isBinaryString($value): |
| 194 | - return '!!binary '.base64_encode($value); |
|
| 194 | + return '!!binary ' . base64_encode($value); |
|
| 195 | 195 | case Escaper::requiresDoubleQuoting($value): |
| 196 | 196 | return Escaper::escapeWithDoubleQuotes($value); |
| 197 | 197 | case Escaper::requiresSingleQuoting($value): |
@@ -297,7 +297,7 @@ discard block |
||
| 297 | 297 | if (Parser::preg_match('/[ \t]+#/', $output, $match, \PREG_OFFSET_CAPTURE)) { |
| 298 | 298 | $output = substr($output, 0, $match[0][1]); |
| 299 | 299 | } |
| 300 | - } elseif (Parser::preg_match('/^(.*?)('.implode('|', $delimiters).')/', substr($scalar, $i), $match)) { |
|
| 300 | + } elseif (Parser::preg_match('/^(.*?)(' . implode('|', $delimiters) . ')/', substr($scalar, $i), $match)) { |
|
| 301 | 301 | $output = $match[1]; |
| 302 | 302 | $i += \strlen($output); |
| 303 | 303 | $output = trim($output); |
@@ -325,7 +325,7 @@ discard block |
||
| 325 | 325 | */ |
| 326 | 326 | private static function parseQuotedScalar(string $scalar, int &$i = 0): string |
| 327 | 327 | { |
| 328 | - if (!Parser::preg_match('/'.self::REGEX_QUOTED_STRING.'/Au', substr($scalar, $i), $match)) { |
|
| 328 | + if (!Parser::preg_match('/' . self::REGEX_QUOTED_STRING . '/Au', substr($scalar, $i), $match)) { |
|
| 329 | 329 | throw new ParseException(sprintf('Malformed inline YAML string: "%s".', substr($scalar, $i)), self::$parsedLineNumber + 1, $scalar, self::$parsedFilename); |
| 330 | 330 | } |
| 331 | 331 | |
@@ -390,7 +390,7 @@ discard block |
||
| 390 | 390 | // embedded mapping? |
| 391 | 391 | try { |
| 392 | 392 | $pos = 0; |
| 393 | - $value = self::parseMapping('{'.$value.'}', $flags, $pos, $references); |
|
| 393 | + $value = self::parseMapping('{' . $value . '}', $flags, $pos, $references); |
|
| 394 | 394 | } catch (\InvalidArgumentException $e) { |
| 395 | 395 | // no, it's not |
| 396 | 396 | } |
@@ -457,7 +457,7 @@ discard block |
||
| 457 | 457 | } |
| 458 | 458 | |
| 459 | 459 | if ('!php/const' === $key) { |
| 460 | - $key .= ' '.self::parseScalar($mapping, $flags, [':'], $i, false); |
|
| 460 | + $key .= ' ' . self::parseScalar($mapping, $flags, [':'], $i, false); |
|
| 461 | 461 | $key = self::evaluateScalar($key, $flags); |
| 462 | 462 | } |
| 463 | 463 | |
@@ -677,7 +677,7 @@ discard block |
||
| 677 | 677 | switch (true) { |
| 678 | 678 | case ctype_digit($scalar): |
| 679 | 679 | if (preg_match('/^0[0-7]+$/', $scalar)) { |
| 680 | - trigger_deprecation('symfony/yaml', '5.1', 'Support for parsing numbers prefixed with 0 as octal numbers. They will be parsed as strings as of 6.0. Use "%s" to represent the octal number.', '0o'.substr($scalar, 1)); |
|
| 680 | + trigger_deprecation('symfony/yaml', '5.1', 'Support for parsing numbers prefixed with 0 as octal numbers. They will be parsed as strings as of 6.0. Use "%s" to represent the octal number.', '0o' . substr($scalar, 1)); |
|
| 681 | 681 | |
| 682 | 682 | return octdec($scalar); |
| 683 | 683 | } |
@@ -687,7 +687,7 @@ discard block |
||
| 687 | 687 | return ($scalar === (string) $cast) ? $cast : $scalar; |
| 688 | 688 | case '-' === $scalar[0] && ctype_digit(substr($scalar, 1)): |
| 689 | 689 | if (preg_match('/^-0[0-7]+$/', $scalar)) { |
| 690 | - trigger_deprecation('symfony/yaml', '5.1', 'Support for parsing numbers prefixed with 0 as octal numbers. They will be parsed as strings as of 6.0. Use "%s" to represent the octal number.', '-0o'.substr($scalar, 2)); |
|
| 690 | + trigger_deprecation('symfony/yaml', '5.1', 'Support for parsing numbers prefixed with 0 as octal numbers. They will be parsed as strings as of 6.0. Use "%s" to represent the octal number.', '-0o' . substr($scalar, 2)); |
|
| 691 | 691 | |
| 692 | 692 | return -octdec(substr($scalar, 1)); |
| 693 | 693 | } |
@@ -699,7 +699,7 @@ discard block |
||
| 699 | 699 | case Parser::preg_match(self::getHexRegex(), $scalar): |
| 700 | 700 | $scalar = str_replace('_', '', $scalar); |
| 701 | 701 | |
| 702 | - return '0x' === $scalar[0].$scalar[1] ? hexdec($scalar) : (float) $scalar; |
|
| 702 | + return '0x' === $scalar[0] . $scalar[1] ? hexdec($scalar) : (float) $scalar; |
|
| 703 | 703 | case '.inf' === $scalarLower: |
| 704 | 704 | case '.nan' === $scalarLower: |
| 705 | 705 | return -log(0); |
@@ -29,21 +29,21 @@ |
||
| 29 | 29 | // on the input arrays. This ordering of the characters avoids the use of strtr, |
| 30 | 30 | // which performs more slowly. |
| 31 | 31 | private const ESCAPEES = ['\\', '\\\\', '\\"', '"', |
| 32 | - "\x00", "\x01", "\x02", "\x03", "\x04", "\x05", "\x06", "\x07", |
|
| 33 | - "\x08", "\x09", "\x0a", "\x0b", "\x0c", "\x0d", "\x0e", "\x0f", |
|
| 34 | - "\x10", "\x11", "\x12", "\x13", "\x14", "\x15", "\x16", "\x17", |
|
| 35 | - "\x18", "\x19", "\x1a", "\x1b", "\x1c", "\x1d", "\x1e", "\x1f", |
|
| 36 | - "\x7f", |
|
| 37 | - "\xc2\x85", "\xc2\xa0", "\xe2\x80\xa8", "\xe2\x80\xa9", |
|
| 38 | - ]; |
|
| 32 | + "\x00", "\x01", "\x02", "\x03", "\x04", "\x05", "\x06", "\x07", |
|
| 33 | + "\x08", "\x09", "\x0a", "\x0b", "\x0c", "\x0d", "\x0e", "\x0f", |
|
| 34 | + "\x10", "\x11", "\x12", "\x13", "\x14", "\x15", "\x16", "\x17", |
|
| 35 | + "\x18", "\x19", "\x1a", "\x1b", "\x1c", "\x1d", "\x1e", "\x1f", |
|
| 36 | + "\x7f", |
|
| 37 | + "\xc2\x85", "\xc2\xa0", "\xe2\x80\xa8", "\xe2\x80\xa9", |
|
| 38 | + ]; |
|
| 39 | 39 | private const ESCAPED = ['\\\\', '\\"', '\\\\', '\\"', |
| 40 | - '\\0', '\\x01', '\\x02', '\\x03', '\\x04', '\\x05', '\\x06', '\\a', |
|
| 41 | - '\\b', '\\t', '\\n', '\\v', '\\f', '\\r', '\\x0e', '\\x0f', |
|
| 42 | - '\\x10', '\\x11', '\\x12', '\\x13', '\\x14', '\\x15', '\\x16', '\\x17', |
|
| 43 | - '\\x18', '\\x19', '\\x1a', '\\e', '\\x1c', '\\x1d', '\\x1e', '\\x1f', |
|
| 44 | - '\\x7f', |
|
| 45 | - '\\N', '\\_', '\\L', '\\P', |
|
| 46 | - ]; |
|
| 40 | + '\\0', '\\x01', '\\x02', '\\x03', '\\x04', '\\x05', '\\x06', '\\a', |
|
| 41 | + '\\b', '\\t', '\\n', '\\v', '\\f', '\\r', '\\x0e', '\\x0f', |
|
| 42 | + '\\x10', '\\x11', '\\x12', '\\x13', '\\x14', '\\x15', '\\x16', '\\x17', |
|
| 43 | + '\\x18', '\\x19', '\\x1a', '\\e', '\\x1c', '\\x1d', '\\x1e', '\\x1f', |
|
| 44 | + '\\x7f', |
|
| 45 | + '\\N', '\\_', '\\L', '\\P', |
|
| 46 | + ]; |
|
| 47 | 47 | |
| 48 | 48 | /** |
| 49 | 49 | * Determines if a PHP value would require double quoting in YAML. |
@@ -29,18 +29,18 @@ discard block |
||
| 29 | 29 | // on the input arrays. This ordering of the characters avoids the use of strtr, |
| 30 | 30 | // which performs more slowly. |
| 31 | 31 | private const ESCAPEES = ['\\', '\\\\', '\\"', '"', |
| 32 | - "\x00", "\x01", "\x02", "\x03", "\x04", "\x05", "\x06", "\x07", |
|
| 33 | - "\x08", "\x09", "\x0a", "\x0b", "\x0c", "\x0d", "\x0e", "\x0f", |
|
| 34 | - "\x10", "\x11", "\x12", "\x13", "\x14", "\x15", "\x16", "\x17", |
|
| 35 | - "\x18", "\x19", "\x1a", "\x1b", "\x1c", "\x1d", "\x1e", "\x1f", |
|
| 32 | + "\x00", "\x01", "\x02", "\x03", "\x04", "\x05", "\x06", "\x07", |
|
| 33 | + "\x08", "\x09", "\x0a", "\x0b", "\x0c", "\x0d", "\x0e", "\x0f", |
|
| 34 | + "\x10", "\x11", "\x12", "\x13", "\x14", "\x15", "\x16", "\x17", |
|
| 35 | + "\x18", "\x19", "\x1a", "\x1b", "\x1c", "\x1d", "\x1e", "\x1f", |
|
| 36 | 36 | "\x7f", |
| 37 | 37 | "\xc2\x85", "\xc2\xa0", "\xe2\x80\xa8", "\xe2\x80\xa9", |
| 38 | 38 | ]; |
| 39 | 39 | private const ESCAPED = ['\\\\', '\\"', '\\\\', '\\"', |
| 40 | - '\\0', '\\x01', '\\x02', '\\x03', '\\x04', '\\x05', '\\x06', '\\a', |
|
| 41 | - '\\b', '\\t', '\\n', '\\v', '\\f', '\\r', '\\x0e', '\\x0f', |
|
| 40 | + '\\0', '\\x01', '\\x02', '\\x03', '\\x04', '\\x05', '\\x06', '\\a', |
|
| 41 | + '\\b', '\\t', '\\n', '\\v', '\\f', '\\r', '\\x0e', '\\x0f', |
|
| 42 | 42 | '\\x10', '\\x11', '\\x12', '\\x13', '\\x14', '\\x15', '\\x16', '\\x17', |
| 43 | - '\\x18', '\\x19', '\\x1a', '\\e', '\\x1c', '\\x1d', '\\x1e', '\\x1f', |
|
| 43 | + '\\x18', '\\x19', '\\x1a', '\\e', '\\x1c', '\\x1d', '\\x1e', '\\x1f', |
|
| 44 | 44 | '\\x7f', |
| 45 | 45 | '\\N', '\\_', '\\L', '\\P', |
| 46 | 46 | ]; |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | */ |
| 53 | 53 | public static function requiresDoubleQuoting(string $value): bool |
| 54 | 54 | { |
| 55 | - return 0 < preg_match('/'.self::REGEX_CHARACTER_TO_ESCAPE.'/u', $value); |
|
| 55 | + return 0 < preg_match('/' . self::REGEX_CHARACTER_TO_ESCAPE . '/u', $value); |
|
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | /** |
@@ -45,12 +45,12 @@ discard block |
||
| 45 | 45 | */ |
| 46 | 46 | public function unescapeDoubleQuotedString(string $value): string |
| 47 | 47 | { |
| 48 | - $callback = function ($match) { |
|
| 48 | + $callback = function($match) { |
|
| 49 | 49 | return $this->unescapeCharacter($match[0]); |
| 50 | 50 | }; |
| 51 | 51 | |
| 52 | 52 | // evaluate the string |
| 53 | - return preg_replace_callback('/'.self::REGEX_ESCAPED_CHARACTER.'/u', $callback, $value); |
|
| 53 | + return preg_replace_callback('/' . self::REGEX_ESCAPED_CHARACTER . '/u', $callback, $value); |
|
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | /** |
@@ -121,12 +121,12 @@ discard block |
||
| 121 | 121 | return \chr($c); |
| 122 | 122 | } |
| 123 | 123 | if (0x800 > $c) { |
| 124 | - return \chr(0xC0 | $c >> 6).\chr(0x80 | $c & 0x3F); |
|
| 124 | + return \chr(0xC0 | $c >> 6) . \chr(0x80 | $c & 0x3F); |
|
| 125 | 125 | } |
| 126 | 126 | if (0x10000 > $c) { |
| 127 | - return \chr(0xE0 | $c >> 12).\chr(0x80 | $c >> 6 & 0x3F).\chr(0x80 | $c & 0x3F); |
|
| 127 | + return \chr(0xE0 | $c >> 12) . \chr(0x80 | $c >> 6 & 0x3F) . \chr(0x80 | $c & 0x3F); |
|
| 128 | 128 | } |
| 129 | 129 | |
| 130 | - return \chr(0xF0 | $c >> 18).\chr(0x80 | $c >> 12 & 0x3F).\chr(0x80 | $c >> 6 & 0x3F).\chr(0x80 | $c & 0x3F); |
|
| 130 | + return \chr(0xF0 | $c >> 18) . \chr(0x80 | $c >> 12 & 0x3F) . \chr(0x80 | $c >> 6 & 0x3F) . \chr(0x80 | $c & 0x3F); |
|
| 131 | 131 | } |
| 132 | 132 | } |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | |
| 70 | 70 | public function apply(string $text): string |
| 71 | 71 | { |
| 72 | - return $this->set().$text.$this->unset(); |
|
| 72 | + return $this->set() . $text . $this->unset(); |
|
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | public function set(): string |
@@ -120,22 +120,22 @@ discard block |
||
| 120 | 120 | $color = substr($color, 1); |
| 121 | 121 | |
| 122 | 122 | if (3 === \strlen($color)) { |
| 123 | - $color = $color[0].$color[0].$color[1].$color[1].$color[2].$color[2]; |
|
| 123 | + $color = $color[0] . $color[0] . $color[1] . $color[1] . $color[2] . $color[2]; |
|
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | if (6 !== \strlen($color)) { |
| 127 | 127 | throw new InvalidArgumentException(sprintf('Invalid "%s" color.', $color)); |
| 128 | 128 | } |
| 129 | 129 | |
| 130 | - return ($background ? '4' : '3').$this->convertHexColorToAnsi(hexdec($color)); |
|
| 130 | + return ($background ? '4' : '3') . $this->convertHexColorToAnsi(hexdec($color)); |
|
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | if (isset(self::COLORS[$color])) { |
| 134 | - return ($background ? '4' : '3').self::COLORS[$color]; |
|
| 134 | + return ($background ? '4' : '3') . self::COLORS[$color]; |
|
| 135 | 135 | } |
| 136 | 136 | |
| 137 | 137 | if (isset(self::BRIGHT_COLORS[$color])) { |
| 138 | - return ($background ? '10' : '9').self::BRIGHT_COLORS[$color]; |
|
| 138 | + return ($background ? '10' : '9') . self::BRIGHT_COLORS[$color]; |
|
| 139 | 139 | } |
| 140 | 140 | |
| 141 | 141 | throw new InvalidArgumentException(sprintf('Invalid "%s" color; expected one of (%s).', $color, implode(', ', array_merge(array_keys(self::COLORS), array_keys(self::BRIGHT_COLORS))))); |
@@ -117,16 +117,16 @@ discard block |
||
| 117 | 117 | private function getInputOptionData(InputOption $option, bool $negated = false): array |
| 118 | 118 | { |
| 119 | 119 | return $negated ? [ |
| 120 | - 'name' => '--no-'.$option->getName(), |
|
| 120 | + 'name' => '--no-' . $option->getName(), |
|
| 121 | 121 | 'shortcut' => '', |
| 122 | 122 | 'accept_value' => false, |
| 123 | 123 | 'is_value_required' => false, |
| 124 | 124 | 'is_multiple' => false, |
| 125 | - 'description' => 'Negate the "--'.$option->getName().'" option', |
|
| 125 | + 'description' => 'Negate the "--' . $option->getName() . '" option', |
|
| 126 | 126 | 'default' => false, |
| 127 | 127 | ] : [ |
| 128 | - 'name' => '--'.$option->getName(), |
|
| 129 | - 'shortcut' => $option->getShortcut() ? '-'.str_replace('|', '|-', $option->getShortcut()) : '', |
|
| 128 | + 'name' => '--' . $option->getName(), |
|
| 129 | + 'shortcut' => $option->getShortcut() ? '-' . str_replace('|', '|-', $option->getShortcut()) : '', |
|
| 130 | 130 | 'accept_value' => $option->acceptValue(), |
| 131 | 131 | 'is_value_required' => $option->isValueRequired(), |
| 132 | 132 | 'is_multiple' => $option->isArray(), |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | foreach ($definition->getOptions() as $name => $option) { |
| 147 | 147 | $inputOptions[$name] = $this->getInputOptionData($option); |
| 148 | 148 | if ($option->isNegatable()) { |
| 149 | - $inputOptions['no-'.$name] = $this->getInputOptionData($option, true); |
|
| 149 | + $inputOptions['no-' . $name] = $this->getInputOptionData($option, true); |
|
| 150 | 150 | } |
| 151 | 151 | } |
| 152 | 152 | |
@@ -205,13 +205,13 @@ discard block |
||
| 205 | 205 | $dom = new \DOMDocument('1.0', 'UTF-8'); |
| 206 | 206 | |
| 207 | 207 | $dom->appendChild($objectXML = $dom->createElement('option')); |
| 208 | - $objectXML->setAttribute('name', '--'.$option->getName()); |
|
| 208 | + $objectXML->setAttribute('name', '--' . $option->getName()); |
|
| 209 | 209 | $pos = strpos($option->getShortcut() ?? '', '|'); |
| 210 | 210 | if (false !== $pos) { |
| 211 | - $objectXML->setAttribute('shortcut', '-'.substr($option->getShortcut(), 0, $pos)); |
|
| 212 | - $objectXML->setAttribute('shortcuts', '-'.str_replace('|', '|-', $option->getShortcut())); |
|
| 211 | + $objectXML->setAttribute('shortcut', '-' . substr($option->getShortcut(), 0, $pos)); |
|
| 212 | + $objectXML->setAttribute('shortcuts', '-' . str_replace('|', '|-', $option->getShortcut())); |
|
| 213 | 213 | } else { |
| 214 | - $objectXML->setAttribute('shortcut', $option->getShortcut() ? '-'.$option->getShortcut() : ''); |
|
| 214 | + $objectXML->setAttribute('shortcut', $option->getShortcut() ? '-' . $option->getShortcut() : ''); |
|
| 215 | 215 | } |
| 216 | 216 | $objectXML->setAttribute('accept_value', $option->acceptValue() ? 1 : 0); |
| 217 | 217 | $objectXML->setAttribute('is_value_required', $option->isValueRequired() ? 1 : 0); |
@@ -233,13 +233,13 @@ discard block |
||
| 233 | 233 | |
| 234 | 234 | if ($option->isNegatable()) { |
| 235 | 235 | $dom->appendChild($objectXML = $dom->createElement('option')); |
| 236 | - $objectXML->setAttribute('name', '--no-'.$option->getName()); |
|
| 236 | + $objectXML->setAttribute('name', '--no-' . $option->getName()); |
|
| 237 | 237 | $objectXML->setAttribute('shortcut', ''); |
| 238 | 238 | $objectXML->setAttribute('accept_value', 0); |
| 239 | 239 | $objectXML->setAttribute('is_value_required', 0); |
| 240 | 240 | $objectXML->setAttribute('is_multiple', 0); |
| 241 | 241 | $objectXML->appendChild($descriptionXML = $dom->createElement('description')); |
| 242 | - $descriptionXML->appendChild($dom->createTextNode('Negate the "--'.$option->getName().'" option')); |
|
| 242 | + $descriptionXML->appendChild($dom->createTextNode('Negate the "--' . $option->getName() . '" option')); |
|
| 243 | 243 | } |
| 244 | 244 | |
| 245 | 245 | return $dom; |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | $argument->getName(), |
| 47 | 47 | str_repeat(' ', $spacingWidth), |
| 48 | 48 | // + 4 = 2 spaces before <info>, 2 spaces after </info> |
| 49 | - preg_replace('/\s*[\r\n]\s*/', "\n".str_repeat(' ', $totalWidth + 4), $argument->getDescription()), |
|
| 49 | + preg_replace('/\s*[\r\n]\s*/', "\n" . str_repeat(' ', $totalWidth + 4), $argument->getDescription()), |
|
| 50 | 50 | $default |
| 51 | 51 | ), $options); |
| 52 | 52 | } |
@@ -64,10 +64,10 @@ discard block |
||
| 64 | 64 | |
| 65 | 65 | $value = ''; |
| 66 | 66 | if ($option->acceptValue()) { |
| 67 | - $value = '='.strtoupper($option->getName()); |
|
| 67 | + $value = '=' . strtoupper($option->getName()); |
|
| 68 | 68 | |
| 69 | 69 | if ($option->isValueOptional()) { |
| 70 | - $value = '['.$value.']'; |
|
| 70 | + $value = '[' . $value . ']'; |
|
| 71 | 71 | } |
| 72 | 72 | } |
| 73 | 73 | |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | $synopsis, |
| 84 | 84 | str_repeat(' ', $spacingWidth), |
| 85 | 85 | // + 4 = 2 spaces before <info>, 2 spaces after </info> |
| 86 | - preg_replace('/\s*[\r\n]\s*/', "\n".str_repeat(' ', $totalWidth + 4), $option->getDescription()), |
|
| 86 | + preg_replace('/\s*[\r\n]\s*/', "\n" . str_repeat(' ', $totalWidth + 4), $option->getDescription()), |
|
| 87 | 87 | $default, |
| 88 | 88 | $option->isArray() ? '<comment> (multiple values allowed)</comment>' : '' |
| 89 | 89 | ), $options); |
@@ -141,14 +141,14 @@ discard block |
||
| 141 | 141 | if ($description = $command->getDescription()) { |
| 142 | 142 | $this->writeText('<comment>Description:</comment>', $options); |
| 143 | 143 | $this->writeText("\n"); |
| 144 | - $this->writeText(' '.$description); |
|
| 144 | + $this->writeText(' ' . $description); |
|
| 145 | 145 | $this->writeText("\n\n"); |
| 146 | 146 | } |
| 147 | 147 | |
| 148 | 148 | $this->writeText('<comment>Usage:</comment>', $options); |
| 149 | 149 | foreach (array_merge([$command->getSynopsis(true)], $command->getAliases(), $command->getUsages()) as $usage) { |
| 150 | 150 | $this->writeText("\n"); |
| 151 | - $this->writeText(' '.OutputFormatter::escape($usage), $options); |
|
| 151 | + $this->writeText(' ' . OutputFormatter::escape($usage), $options); |
|
| 152 | 152 | } |
| 153 | 153 | $this->writeText("\n"); |
| 154 | 154 | |
@@ -164,7 +164,7 @@ discard block |
||
| 164 | 164 | $this->writeText("\n"); |
| 165 | 165 | $this->writeText('<comment>Help:</comment>', $options); |
| 166 | 166 | $this->writeText("\n"); |
| 167 | - $this->writeText(' '.str_replace("\n", "\n ", $help), $options); |
|
| 167 | + $this->writeText(' ' . str_replace("\n", "\n ", $help), $options); |
|
| 168 | 168 | $this->writeText("\n"); |
| 169 | 169 | } |
| 170 | 170 | } |
@@ -208,7 +208,7 @@ discard block |
||
| 208 | 208 | } |
| 209 | 209 | |
| 210 | 210 | // calculate max. width based on available commands per namespace |
| 211 | - $width = $this->getColumnWidth(array_merge(...array_values(array_map(function ($namespace) use ($commands) { |
|
| 211 | + $width = $this->getColumnWidth(array_merge(...array_values(array_map(function($namespace) use ($commands) { |
|
| 212 | 212 | return array_intersect($namespace['commands'], array_keys($commands)); |
| 213 | 213 | }, array_values($namespaces))))); |
| 214 | 214 | |
@@ -219,7 +219,7 @@ discard block |
||
| 219 | 219 | } |
| 220 | 220 | |
| 221 | 221 | foreach ($namespaces as $namespace) { |
| 222 | - $namespace['commands'] = array_filter($namespace['commands'], function ($name) use ($commands) { |
|
| 222 | + $namespace['commands'] = array_filter($namespace['commands'], function($name) use ($commands) { |
|
| 223 | 223 | return isset($commands[$name]); |
| 224 | 224 | }); |
| 225 | 225 | |
@@ -229,7 +229,7 @@ discard block |
||
| 229 | 229 | |
| 230 | 230 | if (!$describedNamespace && ApplicationDescription::GLOBAL_NAMESPACE !== $namespace['id']) { |
| 231 | 231 | $this->writeText("\n"); |
| 232 | - $this->writeText(' <comment>'.$namespace['id'].'</comment>', $options); |
|
| 232 | + $this->writeText(' <comment>' . $namespace['id'] . '</comment>', $options); |
|
| 233 | 233 | } |
| 234 | 234 | |
| 235 | 235 | foreach ($namespace['commands'] as $name) { |
@@ -237,7 +237,7 @@ discard block |
||
| 237 | 237 | $spacingWidth = $width - Helper::width($name); |
| 238 | 238 | $command = $commands[$name]; |
| 239 | 239 | $commandAliases = $name === $command->getName() ? $this->getCommandAliasesText($command) : ''; |
| 240 | - $this->writeText(sprintf(' <info>%s</info>%s%s', $name, str_repeat(' ', $spacingWidth), $commandAliases.$command->getDescription()), $options); |
|
| 240 | + $this->writeText(sprintf(' <info>%s</info>%s%s', $name, str_repeat(' ', $spacingWidth), $commandAliases . $command->getDescription()), $options); |
|
| 241 | 241 | } |
| 242 | 242 | } |
| 243 | 243 | |
@@ -265,7 +265,7 @@ discard block |
||
| 265 | 265 | $aliases = $command->getAliases(); |
| 266 | 266 | |
| 267 | 267 | if ($aliases) { |
| 268 | - $text = '['.implode('|', $aliases).'] '; |
|
| 268 | + $text = '[' . implode('|', $aliases) . '] '; |
|
| 269 | 269 | } |
| 270 | 270 | |
| 271 | 271 | return $text; |
@@ -55,11 +55,11 @@ discard block |
||
| 55 | 55 | protected function describeInputArgument(InputArgument $argument, array $options = []) |
| 56 | 56 | { |
| 57 | 57 | $this->write( |
| 58 | - '#### `'.($argument->getName() ?: '<none>')."`\n\n" |
|
| 59 | - .($argument->getDescription() ? preg_replace('/\s*[\r\n]\s*/', "\n", $argument->getDescription())."\n\n" : '') |
|
| 60 | - .'* Is required: '.($argument->isRequired() ? 'yes' : 'no')."\n" |
|
| 61 | - .'* Is array: '.($argument->isArray() ? 'yes' : 'no')."\n" |
|
| 62 | - .'* Default: `'.str_replace("\n", '', var_export($argument->getDefault(), true)).'`' |
|
| 58 | + '#### `' . ($argument->getName() ?: '<none>') . "`\n\n" |
|
| 59 | + .($argument->getDescription() ? preg_replace('/\s*[\r\n]\s*/', "\n", $argument->getDescription()) . "\n\n" : '') |
|
| 60 | + .'* Is required: ' . ($argument->isRequired() ? 'yes' : 'no') . "\n" |
|
| 61 | + .'* Is array: ' . ($argument->isArray() ? 'yes' : 'no') . "\n" |
|
| 62 | + .'* Default: `' . str_replace("\n", '', var_export($argument->getDefault(), true)) . '`' |
|
| 63 | 63 | ); |
| 64 | 64 | } |
| 65 | 65 | |
@@ -68,22 +68,22 @@ discard block |
||
| 68 | 68 | */ |
| 69 | 69 | protected function describeInputOption(InputOption $option, array $options = []) |
| 70 | 70 | { |
| 71 | - $name = '--'.$option->getName(); |
|
| 71 | + $name = '--' . $option->getName(); |
|
| 72 | 72 | if ($option->isNegatable()) { |
| 73 | - $name .= '|--no-'.$option->getName(); |
|
| 73 | + $name .= '|--no-' . $option->getName(); |
|
| 74 | 74 | } |
| 75 | 75 | if ($option->getShortcut()) { |
| 76 | - $name .= '|-'.str_replace('|', '|-', $option->getShortcut()).''; |
|
| 76 | + $name .= '|-' . str_replace('|', '|-', $option->getShortcut()) . ''; |
|
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | $this->write( |
| 80 | - '#### `'.$name.'`'."\n\n" |
|
| 81 | - .($option->getDescription() ? preg_replace('/\s*[\r\n]\s*/', "\n", $option->getDescription())."\n\n" : '') |
|
| 82 | - .'* Accept value: '.($option->acceptValue() ? 'yes' : 'no')."\n" |
|
| 83 | - .'* Is value required: '.($option->isValueRequired() ? 'yes' : 'no')."\n" |
|
| 84 | - .'* Is multiple: '.($option->isArray() ? 'yes' : 'no')."\n" |
|
| 85 | - .'* Is negatable: '.($option->isNegatable() ? 'yes' : 'no')."\n" |
|
| 86 | - .'* Default: `'.str_replace("\n", '', var_export($option->getDefault(), true)).'`' |
|
| 80 | + '#### `' . $name . '`' . "\n\n" |
|
| 81 | + .($option->getDescription() ? preg_replace('/\s*[\r\n]\s*/', "\n", $option->getDescription()) . "\n\n" : '') |
|
| 82 | + .'* Accept value: ' . ($option->acceptValue() ? 'yes' : 'no') . "\n" |
|
| 83 | + .'* Is value required: ' . ($option->isValueRequired() ? 'yes' : 'no') . "\n" |
|
| 84 | + .'* Is multiple: ' . ($option->isArray() ? 'yes' : 'no') . "\n" |
|
| 85 | + .'* Is negatable: ' . ($option->isNegatable() ? 'yes' : 'no') . "\n" |
|
| 86 | + .'* Default: `' . str_replace("\n", '', var_export($option->getDefault(), true)) . '`' |
|
| 87 | 87 | ); |
| 88 | 88 | } |
| 89 | 89 | |
@@ -124,12 +124,12 @@ discard block |
||
| 124 | 124 | { |
| 125 | 125 | if ($options['short'] ?? false) { |
| 126 | 126 | $this->write( |
| 127 | - '`'.$command->getName()."`\n" |
|
| 128 | - .str_repeat('-', Helper::width($command->getName()) + 2)."\n\n" |
|
| 129 | - .($command->getDescription() ? $command->getDescription()."\n\n" : '') |
|
| 130 | - .'### Usage'."\n\n" |
|
| 131 | - .array_reduce($command->getAliases(), function ($carry, $usage) { |
|
| 132 | - return $carry.'* `'.$usage.'`'."\n"; |
|
| 127 | + '`' . $command->getName() . "`\n" |
|
| 128 | + .str_repeat('-', Helper::width($command->getName()) + 2) . "\n\n" |
|
| 129 | + .($command->getDescription() ? $command->getDescription() . "\n\n" : '') |
|
| 130 | + .'### Usage' . "\n\n" |
|
| 131 | + .array_reduce($command->getAliases(), function($carry, $usage) { |
|
| 132 | + return $carry . '* `' . $usage . '`' . "\n"; |
|
| 133 | 133 | }) |
| 134 | 134 | ); |
| 135 | 135 | |
@@ -139,12 +139,12 @@ discard block |
||
| 139 | 139 | $command->mergeApplicationDefinition(false); |
| 140 | 140 | |
| 141 | 141 | $this->write( |
| 142 | - '`'.$command->getName()."`\n" |
|
| 143 | - .str_repeat('-', Helper::width($command->getName()) + 2)."\n\n" |
|
| 144 | - .($command->getDescription() ? $command->getDescription()."\n\n" : '') |
|
| 145 | - .'### Usage'."\n\n" |
|
| 146 | - .array_reduce(array_merge([$command->getSynopsis()], $command->getAliases(), $command->getUsages()), function ($carry, $usage) { |
|
| 147 | - return $carry.'* `'.$usage.'`'."\n"; |
|
| 142 | + '`' . $command->getName() . "`\n" |
|
| 143 | + .str_repeat('-', Helper::width($command->getName()) + 2) . "\n\n" |
|
| 144 | + .($command->getDescription() ? $command->getDescription() . "\n\n" : '') |
|
| 145 | + .'### Usage' . "\n\n" |
|
| 146 | + .array_reduce(array_merge([$command->getSynopsis()], $command->getAliases(), $command->getUsages()), function($carry, $usage) { |
|
| 147 | + return $carry . '* `' . $usage . '`' . "\n"; |
|
| 148 | 148 | }) |
| 149 | 149 | ); |
| 150 | 150 | |
@@ -169,16 +169,16 @@ discard block |
||
| 169 | 169 | $description = new ApplicationDescription($application, $describedNamespace); |
| 170 | 170 | $title = $this->getApplicationTitle($application); |
| 171 | 171 | |
| 172 | - $this->write($title."\n".str_repeat('=', Helper::width($title))); |
|
| 172 | + $this->write($title . "\n" . str_repeat('=', Helper::width($title))); |
|
| 173 | 173 | |
| 174 | 174 | foreach ($description->getNamespaces() as $namespace) { |
| 175 | 175 | if (ApplicationDescription::GLOBAL_NAMESPACE !== $namespace['id']) { |
| 176 | 176 | $this->write("\n\n"); |
| 177 | - $this->write('**'.$namespace['id'].':**'); |
|
| 177 | + $this->write('**' . $namespace['id'] . ':**'); |
|
| 178 | 178 | } |
| 179 | 179 | |
| 180 | 180 | $this->write("\n\n"); |
| 181 | - $this->write(implode("\n", array_map(function ($commandName) use ($description) { |
|
| 181 | + $this->write(implode("\n", array_map(function($commandName) use ($description) { |
|
| 182 | 182 | return sprintf('* [`%s`](#%s)', $commandName, str_replace(':', '', $description->getCommand($commandName)->getName())); |
| 183 | 183 | }, $namespace['commands']))); |
| 184 | 184 | } |