private static function fillCurrentHeaders(self $request)
    {
        $headers = [];

        //Native method exists?
        if (function_exists('getallheaders')) {

            //try to use it
            if (($headers = getallheaders()) === false) {
                $headers = [];
            }
        }

        //No header captured yet? Try to get it myself
        if (empty($headers)) {

            /*
             * Based on a user note provided by joyview
             * at http://php.net/manual/en/function.getallheaders.php
             */
            foreach ($_SERVER as $key => $value) {
                if (substr($key, 0, 5) === 'HTTP_') {
                    $newKey = str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', substr($key, 5)))));
                    $headers[$newKey] = $value;
                }
            }
        }

        $request->setHeaders($headers);
    }
private static function fillCurrentHeaders(self $request)
    {
        $headers = [];

        //Native method exists?
        if (function_exists('getallheaders')) {

            //try to use it
            if (($headers = getallheaders()) === false) {
                $headers = [];
            }
        }

        //No header captured yet? Try to get it myself
        if (empty($headers)) {

            /*
             * Based on a user note provided by joyview
             * at http://php.net/manual/en/function.getallheaders.php
             */
            foreach ($_SERVER as $key => $value) {
                if (substr($key, 0, 5) === 'HTTP_') {
                    $newKey = str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', substr($key, 5)))));
                    $headers[$newKey] = $value;
                }
            }
        }

        $request->setHeaders($headers);
    }
private static function fillCurrentHeaders ( self $ request ) { $ headers = [ ] ; //Native method exists? if ( function_exists ( 'getallheaders' ) ) { //try to use it if ( ( $ headers = getallheaders ( ) ) === false ) { $ headers = [ ] ; } } //No header captured yet? Try to get it myself if ( empty ( $ headers ) ) { /*
             * Based on a user note provided by joyview
             * at http://php.net/manual/en/function.getallheaders.php
             */ foreach ( $ _SERVER as $ key => $ value ) { if ( substr ( $ key , 0 , 5 ) === 'HTTP_' ) { $ newKey = str_replace ( ' ' , '-' , ucwords ( strtolower ( str_replace ( '_' , ' ' , substr ( $ key , 5 ) ) ) ) ) ; $ headers [ $ newKey ] = $ value ; } } } $ request -> setHeaders ( $ headers ) ; }
Fill up the headers property with the values
provided by the client browser.

@param Request $request
Fill up the headers property with the values provided by the client browser .