Lukasoppermann\Httpstatus\Httpstatus::filterReasonPhrase PHP Method

filterReasonPhrase() protected method

Filter a Reason Phrase.
See also: http://tools.ietf.org/html/rfc2616#section-6.1.1
protected filterReasonPhrase ( string $text ) : string
$text string
return string
    protected function filterReasonPhrase($text)
    {
        if (!(is_object($text) && method_exists($text, '__toString')) && !is_string($text)) {
            throw new InvalidArgumentException('The reason phrase must be a string');
        }
        $text = trim($text);
        if (preg_match(',[\\r\\n],', $text)) {
            throw new InvalidArgumentException('The reason phrase can not contain carriage return characters');
        }
        return $text;
    }