+
+ if (! is_string($reasonPhrase)) {
+ throw new InvalidArgumentException(sprintf(
+ 'Unsupported response reason phrase; must be a string, received %s',
+ is_object($reasonPhrase) ? get_class($reasonPhrase) : gettype($reasonPhrase)
+ ));
+ }
+
+ if ($reasonPhrase === '' && isset($this->phrases[$code])) {
+ $reasonPhrase = $this->phrases[$code];
+ }
+
+ $this->reasonPhrase = $reasonPhrase;
+ $this->statusCode = (int) $code;