| Total Complexity | 8 |
| Total Lines | 60 |
| Duplicated Lines | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 12 | class Common |
||
| 13 | { |
||
| 14 | |||
| 15 | /** |
||
| 16 | * Validate the given string is JSON or not |
||
| 17 | * |
||
| 18 | * @param ?string $string |
||
| 19 | * @return bool |
||
| 20 | */ |
||
| 21 | public static function isJson(?string $string): bool |
||
| 30 | } |
||
| 31 | |||
| 32 | /** |
||
| 33 | * Check string is a url encoded string or not |
||
| 34 | * |
||
| 35 | * @param ?string $string |
||
| 36 | * @return bool |
||
| 37 | */ |
||
| 38 | public static function isUrlEncode(?string $string): bool |
||
| 39 | { |
||
| 40 | if (!is_string($string)) { |
||
| 41 | return false; |
||
| 42 | } |
||
| 43 | |||
| 44 | return preg_match('/%[0-9A-F]{2}/i', $string); |
||
|
|
|||
| 45 | } |
||
| 46 | |||
| 47 | /** |
||
| 48 | * Convert url encoded string to array |
||
| 49 | * |
||
| 50 | * @param string $string |
||
| 51 | * @return array |
||
| 52 | */ |
||
| 53 | public static function urlDecode(string $string): array |
||
| 72 | } |
||
| 73 | |||
| 74 | } |