src/Exceptions/MutableErrorCollection.php
public function getHttpStatus($default = null)
    {
        $default = $default ?: JsonApiException::DEFAULT_HTTP_CODE;
        $request = null;
        $internal = null;

        /** @var MutableErrorInterface $error */
        foreach ($this as $error) {

            $status = $error->getStatus();

            if (400 <= $status && 499 >= $status) {
                $request = is_null($request) ? $status : ($request == $status) ? $status : 400;
            } elseif (500 <= $status && 599 >= $status) {
                $internal = is_null($internal) ? $status : ($internal == $status) ? $status : 500;
            }
        }

        if (!$request && !$internal) {
            return $default;
        } elseif ($request && $internal) {
            return 500;
        }

        return $request ?: $internal;
    }
public function getHttpStatus($default = null)
    {
        $default = $default ?: JsonApiException::DEFAULT_HTTP_CODE;
        $request = null;
        $internal = null;

        /** @var MutableErrorInterface $error */
        foreach ($this as $error) {

            $status = $error->getStatus();

            if (400 <= $status && 499 >= $status) {
                $request = is_null($request) ? $status : ($request == $status) ? $status : 400;
            } elseif (500 <= $status && 599 >= $status) {
                $internal = is_null($internal) ? $status : ($internal == $status) ? $status : 500;
            }
        }

        if (!$request && !$internal) {
            return $default;
        } elseif ($request && $internal) {
            return 500;
        }

        return $request ?: $internal;
    }
public function getHttpStatus ( $ default = null ) { $ default = $ default ? : JsonApiException :: DEFAULT_HTTP_CODE ; $ request = null ; $ internal = null ; /** @var MutableErrorInterface $error */ foreach ( $ this as $ error ) { $ status = $ error -> getStatus ( ) ; if ( 400 <= $ status && 499 >= $ status ) { $ request = is_null ( $ request ) ? $ status : ( $ request == $ status ) ? $ status : 400 ; } elseif ( 500 <= $ status && 599 >= $ status ) { $ internal = is_null ( $ internal ) ? $ status : ( $ internal == $ status ) ? $ status : 500 ; } } if ( ! $ request && ! $ internal ) { return $ default ; } elseif ( $ request && $ internal ) { return 500 ; } return $ request ? : $ internal ; }
Get the most applicable HTTP status code.

From the spec:
When a server encounters multiple problems for a single request, the most generally applicable HTTP error
code SHOULD be used in the response. For instance, 400 Bad Request might be appropriate for multiple
4xx errors or 500 Internal Server Error might be appropriate for multiple 5xx errors.

@param string|int|null $default
the default to use if an error status cannot be resolved. Defaults to 400 Bad Request
@return string|int
Get the most applicable HTTP status code .