Ergo\Http\Status::getMessage PHP Method

getMessage() public method

The message associated with, but not including, the status code.
public getMessage ( ) : string
return string
    public function getMessage()
    {
        $code = $this->getCode();
        if (!array_key_exists($code, $this->_messageMap)) {
            throw new \Ergo\Routing\Exception("Unknown HTTP status code: {$code}");
        }
        return $this->_messageMap[$code];
    }

Usage Example

示例#1
0
 public function testTeaPot()
 {
     $status = new Http\Status(418);
     $this->assertEquals($status->getMessage(), "I'm a Teapot");
 }