You are here

private function Response::validateStatus in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/zendframework/zend-diactoros/src/Response.php \Zend\Diactoros\Response::validateStatus()

Validate a status code.

Parameters

int|string $code:

Throws

InvalidArgumentException on an invalid status code.

2 calls to Response::validateStatus()
Response::withStatus in vendor/zendframework/zend-diactoros/src/Response.php
Return an instance with the specified status code and, optionally, reason phrase.
Response::__construct in vendor/zendframework/zend-diactoros/src/Response.php

File

vendor/zendframework/zend-diactoros/src/Response.php, line 175

Class

Response
HTTP response encapsulation.

Namespace

Zend\Diactoros

Code

private function validateStatus($code) {
  if (!is_numeric($code) || is_float($code) || $code < 100 || $code >= 600) {
    throw new InvalidArgumentException(sprintf('Invalid status code "%s"; must be an integer between 100 and 599, inclusive', is_scalar($code) ? $code : gettype($code)));
  }
}