src/Parser/ParserAbstract.php
protected function splitMessage($message)
    {
        if ($this->mode == self::MODE_STRICT) {
            $pos    = strpos($message, Http::NEW_LINE . Http::NEW_LINE);
            $header = substr($message, 0, $pos);
            $body   = trim(substr($message, $pos + 1));
        } elseif ($this->mode == self::MODE_LOOSE) {
            $lines  = explode("\n", $message);
            $header = '';
            $body   = '';
            $found  = false;
            $count  = count($lines);

            foreach ($lines as $i => $line) {
                $line = trim($line);

                if (!$found && empty($line)) {
                    $found = true;
                    continue;
                }

                if (!$found) {
                    $header.= $line . Http::NEW_LINE;
                } else {
                    $body.= $line . ($i < $count - 1 ? "\n" : '');
                }
            }
        }

        return array($header, $body);
    }
protected function splitMessage($message)
    {
        if ($this->mode == self::MODE_STRICT) {
            $pos    = strpos($message, Http::NEW_LINE . Http::NEW_LINE);
            $header = substr($message, 0, $pos);
            $body   = trim(substr($message, $pos + 1));
        } elseif ($this->mode == self::MODE_LOOSE) {
            $lines  = explode("\n", $message);
            $header = '';
            $body   = '';
            $found  = false;
            $count  = count($lines);

            foreach ($lines as $i => $line) {
                $line = trim($line);

                if (!$found && empty($line)) {
                    $found = true;
                    continue;
                }

                if (!$found) {
                    $header.= $line . Http::NEW_LINE;
                } else {
                    $body.= $line . ($i < $count - 1 ? "\n" : '');
                }
            }
        }

        return array($header, $body);
    }
protected function splitMessage ( $ message ) { if ( $ this -> mode == self :: MODE_STRICT ) { $ pos = strpos ( $ message , Http :: NEW_LINE . Http :: NEW_LINE ) ; $ header = substr ( $ message , 0 , $ pos ) ; $ body = trim ( substr ( $ message , $ pos + 1 ) ) ; } elseif ( $ this -> mode == self :: MODE_LOOSE ) { $ lines = explode ( "\n" , $ message ) ; $ header = '' ; $ body = '' ; $ found = false ; $ count = count ( $ lines ) ; foreach ( $ lines as $ i => $ line ) { $ line = trim ( $ line ) ; if ( ! $ found && empty ( $ line ) ) { $ found = true ; continue ; } if ( ! $ found ) { $ header .= $ line . Http :: NEW_LINE ; } else { $ body .= $ line . ( $ i < $ count - 1 ? "\n" : '' ) ; } } } return array ( $ header , $ body ) ; }
Splits an given http message into the header and body part

@param string $message
@return array
Splits an given http message into the header and body part