public function testMultiline() { $raw = <<<EOT HTTP/1.1 200 OK Date: Tue, Jul 31 18:23:39 MSD 2007 Server: Nginx Content-Length: 123 Keep-Alive: timeout=20, \tmax=200 Connection: Keep-Alive Content-Type: text/html; charset=utf-8 EOT; $parser = HeaderParser::create()->parse($raw); $this->assertEquals(6, count($parser->getHeaders())); $this->assertEquals($parser->getHeader('keep-alive'), 'timeout=20, max=200'); $this->assertEquals($parser->getHeader('content-length'), '123'); }
public static function createFromString($fieldName, $fieldValue, array $requiredKeys = null) { return static::create($fieldName, HeaderParser::parseFieldValue($fieldValue, $requiredKeys)); }
function getHeaderArray() { $header_parser = new HeaderParser($this->headers); return $header_parser->getHeaderAr(); }
public function __construct() { $this->headerParser = HeaderParser::create(); $this->currentFileSize = 0; }