コード例 #1
0
ファイル: Response.php プロジェクト: bluepsyduck/multicurl
 /**
  * Returns the header of the last redirect of the request.
  * @return \BluePsyduck\MultiCurl\Utils\Collection|null
  */
 public function getLastHeader()
 {
     return $this->headers->top();
 }
コード例 #2
0
ファイル: Manager.php プロジェクト: bluepsyduck/multicurl
 /**
  * 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;
 }
コード例 #3
0
 /**
  * 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');
 }