src/Response/JsonResponse.php
/**
     * Encode the provided data to JSON.
     *
     * @param mixed $data
     * @throws Exception\InvalidArgumentException if unable to encode the $data to JSON.
     */
Encode the provided data to JSON.
@param mixed $data
@throws Exception\InvalidArgumentException if unable to encode the $data to JSON.
Encode the provided data to JSON . @param mixed $data @throws Exception \ InvalidArgumentException if unable to encode the $data to JSON .
private function jsonEncode($data, int $encodingOptions) : string
    {
        if (is_resource($data)) {
            throw new Exception\InvalidArgumentException('Cannot JSON encode resources');
        }
        json_encode(null);
        $json = json_encode($data, $encodingOptions);
        if (JSON_ERROR_NONE !== json_last_error()) {
            throw new Exception\InvalidArgumentException(sprintf(
                'Unable to encode data to JSON in %s: %s',
                __CLASS__,
                json_last_error_msg()
            ));
        }
        return $json;
    }
private function jsonEncode ( $ data , int $ encodingOptions ) : string { if ( is_resource ( $ data ) ) { throw new Exception \ InvalidArgumentException ( 'Cannot JSON encode resources' ) ; } json_encode ( null ) ; $ json = json_encode ( $ data , $ encodingOptions ) ; if ( JSON_ERROR_NONE !== json_last_error ( ) ) { throw new Exception \ InvalidArgumentException ( sprintf ( 'Unable to encode data to JSON in %s: %s' , __CLASS__ , json_last_error_msg ( ) ) ) ; } return $ json ; }
Encode the provided data to JSON.
Encode the provided data to JSON .
// Clear json_last_error()