@@ -77,8 +77,8 @@ discard block |
||
| 77 | 77 | |
| 78 | 78 | /** |
| 79 | 79 | * Convert hexadecimal number (range 0..15) into uppercased hex digit (0..9, A..F) |
| 80 | - * @param $byte number in range 0..15 |
|
| 81 | - * @return uppercased hex digit (0..9, A..F) or underscore (in case of error) |
|
| 80 | + * @param integer $byte number in range 0..15 |
|
| 81 | + * @return string hex digit (0..9, A..F) or underscore (in case of error) |
|
| 82 | 82 | */ |
| 83 | 83 | public static function digit2hex($byte) |
| 84 | 84 | { |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | |
| 94 | 94 | /** |
| 95 | 95 | * Convert symbols from higher half of ANSI table into it's percent-encoded presentation |
| 96 | - * @param $str UTF-8 encoded string |
|
| 96 | + * @param string $str UTF-8 encoded string |
|
| 97 | 97 | * @return string with higher half of ANSI table percent-encoded |
| 98 | 98 | */ |
| 99 | 99 | public static function patternEncode($str){ |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | /** |
| 110 | 110 | * Create new route |
| 111 | 111 | * |
| 112 | - * @param string|string[] $methods The route HTTP methods |
|
| 112 | + * @param string[] $methods The route HTTP methods |
|
| 113 | 113 | * @param string $pattern The route pattern |
| 114 | 114 | * @param callable $callable The route callable |
| 115 | 115 | * @param RouteGroup[] $groups The parent route groups |
@@ -83,10 +83,10 @@ discard block |
||
| 83 | 83 | public static function digit2hex($byte) |
| 84 | 84 | { |
| 85 | 85 | if (($byte >= 0) && ($byte <= 9)) { |
| 86 | - return chr($byte+ord('0')); |
|
| 86 | + return chr($byte + ord('0')); |
|
| 87 | 87 | } |
| 88 | 88 | if (($byte >= 10) && ($byte <= 15)) { |
| 89 | - return chr($byte+ord('A')-10); |
|
| 89 | + return chr($byte + ord('A') - 10); |
|
| 90 | 90 | } |
| 91 | 91 | return '_'; |
| 92 | 92 | } |
@@ -96,11 +96,11 @@ discard block |
||
| 96 | 96 | * @param $str UTF-8 encoded string |
| 97 | 97 | * @return string with higher half of ANSI table percent-encoded |
| 98 | 98 | */ |
| 99 | - public static function patternEncode($str){ |
|
| 100 | - $arr=str_split($str); |
|
| 99 | + public static function patternEncode($str) { |
|
| 100 | + $arr = str_split($str); |
|
| 101 | 101 | foreach ($arr as &$value) { |
| 102 | 102 | if (ord($value) > 127) { |
| 103 | - $value='%' . self::digit2hex(ord($value) >> 4) . self::digit2hex(ord($value) & 0xF); |
|
| 103 | + $value = '%' . self::digit2hex(ord($value) >> 4) . self::digit2hex(ord($value) & 0xF); |
|
| 104 | 104 | } |
| 105 | 105 | } |
| 106 | 106 | return implode($arr); |