| 1 | <?php |
||
| 12 | abstract class JSON { |
||
| 13 | |||
| 14 | /** |
||
| 15 | * Parse a string as JSON |
||
| 16 | * |
||
| 17 | * @return mixed|null : the JSON value or null on failure |
||
| 18 | */ |
||
| 19 | |||
| 20 | public static function parse(string $string) { |
||
| 24 | |||
| 25 | /** |
||
| 26 | * Convert a JSON value to a string |
||
| 27 | * |
||
| 28 | * @return string|false : the string or false on failure |
||
| 29 | */ |
||
| 30 | |||
| 31 | public static function stringify($value) { |
||
| 35 | |||
| 36 | /** |
||
| 37 | * Load a JSON value from a file |
||
| 38 | * |
||
| 39 | * @return mixed|null : the JSON value or null on failure |
||
| 40 | */ |
||
| 41 | |||
| 42 | public static function load(string $file_name) { |
||
| 48 | |||
| 49 | /** |
||
| 50 | * Save a JSON value into a file |
||
| 51 | * |
||
| 52 | * @return int|false : the number of bytes that were written to the file or false on failure |
||
| 53 | */ |
||
| 54 | |||
| 55 | public static function save(string $file_name, $value) { |
||
| 61 | |||
| 62 | /** |
||
| 63 | * Output JSON |
||
| 64 | */ |
||
| 65 | |||
| 66 | public static function output($value) { |
||
| 72 | } |
||
| 73 | } |
||
| 74 |