src/Terranet/Localizer/Resolvers/RequestResolver.php
private function resolveHeader()
    {
        if (null === static::$languages) {
            $httpLanguages = $this->request->server(config('localizer.request.header', 'HTTP_ACCEPT_LANGUAGE'));

            if (empty($httpLanguages)) {
                static::$languages = [];
            } else {
                $accepted = preg_split('/,\s*/', $httpLanguages);

                static::$languages = empty($languages = $this->buildCollection($accepted, $languages = []))
                    ? null
                    : array_keys($languages)[0];
            }
        }

        return static::$languages;
    }
private function resolveHeader()
    {
        if (null === static::$languages) {
            $httpLanguages = $this->request->server(config('localizer.request.header', 'HTTP_ACCEPT_LANGUAGE'));

            if (empty($httpLanguages)) {
                static::$languages = [];
            } else {
                $accepted = preg_split('/,\s*/', $httpLanguages);

                static::$languages = empty($languages = $this->buildCollection($accepted, $languages = []))
                    ? null
                    : array_keys($languages)[0];
            }
        }

        return static::$languages;
    }
private function resolveHeader ( ) { if ( null === static :: $ languages ) { $ httpLanguages = $ this -> request -> server ( config ( 'localizer.request.header' , 'HTTP_ACCEPT_LANGUAGE' ) ) ; if ( empty ( $ httpLanguages ) ) { static :: $ languages = [ ] ; } else { $ accepted = preg_split ( '/,\s*/' , $ httpLanguages ) ; static :: $ languages = empty ( $ languages = $ this -> buildCollection ( $ accepted , $ languages = [ ] ) ) ? null : array_keys ( $ languages ) [ 0 ] ; } } return static :: $ languages ; }
Resolve language using HTTP_ACCEPT_LANGUAGE header
which is used mostly by API requests

@return array|null
Resolve language using HTTP_ACCEPT_LANGUAGE header which is used mostly by API requests