src/Exceptions/Error.php
public static function parseErrors($json_string)
    {
        $error_obj = json_decode($json_string);
        $errors = [];
        if (!empty($error_obj->errors)) {
            foreach ($error_obj->errors as $error) {
                $errors[] = new self($error->code, $error->path, $error->description);
            }
        } elseif (!empty($error_obj->error)) {
            $errors[] = new self('', '', $error_obj->error);
        }

        return $errors;
    }
public static function parseErrors($json_string)
    {
        $error_obj = json_decode($json_string);
        $errors = [];
        if (!empty($error_obj->errors)) {
            foreach ($error_obj->errors as $error) {
                $errors[] = new self($error->code, $error->path, $error->description);
            }
        } elseif (!empty($error_obj->error)) {
            $errors[] = new self('', '', $error_obj->error);
        }

        return $errors;
    }
public static function parseErrors ( $ json_string ) { $ error_obj = json_decode ( $ json_string ) ; $ errors = [ ] ; if ( ! empty ( $ error_obj -> errors ) ) { foreach ( $ error_obj -> errors as $ error ) { $ errors [ ] = new self ( $ error -> code , $ error -> path , $ error -> description ) ; } } elseif ( ! empty ( $ error_obj -> error ) ) { $ errors [ ] = new self ( '' , '' , $ error_obj -> error ) ; } return $ errors ; }
Creates an Error array from a json string.

@param string $json_string string returned by the Moip API

@return array
Creates an Error array from a json string .