Symfony\Component\HttpFoundation\Response::isInvalid PHP Method

isInvalid() public method

Is response invalid?
See also: http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html
public isInvalid ( ) : boolean
return boolean
    public function isInvalid()
    {
        return $this->statusCode < 100 || $this->statusCode >= 600;
    }

Usage Example

Exemplo n.º 1
0
 public function testIsInvalid()
 {
     $response = new Response();
     try {
         $response->setStatusCode(99);
         $this->fail();
     } catch (\InvalidArgumentException $e) {
         $this->assertTrue($response->isInvalid());
     }
     try {
         $response->setStatusCode(650);
         $this->fail();
     } catch (\InvalidArgumentException $e) {
         $this->assertTrue($response->isInvalid());
     }
     $response = new Response('', 200);
     $this->assertFalse($response->isInvalid());
 }