blockMode = $blockMode; $encoder->indentation = $indentation; return $encoder->encode($value); } /** * Converts given NEON to PHP value. */ public static function decode(string $input): mixed { $decoder = new Decoder; return $decoder->decode($input); } /** * Converts given NEON file to PHP value. */ public static function decodeFile(string $file): mixed { $input = @file_get_contents($file); // @ is escalated to exception if ($input === false) { $error = preg_replace('#^\w+\(.*?\): #', '', error_get_last()['message'] ?? ''); throw new Exception("Unable to read file '$file'. $error"); } if (str_starts_with($input, "\u{FEFF}")) { // BOM $input = substr($input, 3); } return self::decode($input); } }