/** * Returns the header of the last redirect of the request. * @return \BluePsyduck\MultiCurl\Utils\Collection|null */ public function getLastHeader() { return $this->headers->top(); }
/** * Parses the header string into an associative array. * @param string $headerString * @return \BluePsyduck\MultiCurl\Utils\Collection */ protected function parseHeaders($headerString) { $result = new Collection(); foreach (array_filter(explode("\r\n\r\n", $headerString)) as $responseHeader) { $header = new Collection(); foreach (explode("\r\n", $responseHeader) as $headerLine) { $parts = explode(':', $headerLine, 2); if (count($parts) === 2) { $header->set(trim($parts[0]), trim($parts[1])); } } $result->push($header); } return $result; }
/** * Tests the setIsDirty() method. * @covers \BluePsyduck\MultiCurl\Utils\Collection::setIsDirty */ public function testSetIsDirty() { $expected = true; $collection = new Collection(); $result = $collection->setIsDirty($expected); $this->assertEquals($collection, $result); $this->assertPropertyEquals($expected, $collection, 'isDirty'); }