コード例 #1
0
 /**
  * @covers Kokoroe\Http\HeaderBag::contains
  */
 public function testContains()
 {
     $bag = new HeaderBag(['foo' => 'bar', 'fuzz' => 'bizz']);
     $this->assertTrue($bag->contains('foo', 'bar'), '->contains first value');
     $this->assertTrue($bag->contains('fuzz', 'bizz'), '->contains second value');
     $this->assertFalse($bag->contains('nope', 'nope'), '->contains unknown value');
     $this->assertFalse($bag->contains('foo', 'nope'), '->contains unknown value');
     // Multiple values
     $bag->set('foo', 'bor', false);
     $this->assertTrue($bag->contains('foo', 'bar'), '->contains first value');
     $this->assertTrue($bag->contains('foo', 'bor'), '->contains second value');
     $this->assertFalse($bag->contains('foo', 'nope'), '->contains unknown value');
 }
コード例 #2
0
ファイル: Response.php プロジェクト: kokoroe/kokoroe-sdk-php
 /**
  * Is the response a redirect of some form?
  *
  * @param string $location
  *
  * @return bool
  */
 public function isRedirect($location = null)
 {
     return in_array($this->statusCode, [201, 301, 302, 303, 307, 308]) && (null === $location ?: $location == $this->headers->get('Location'));
 }