webignition/is-http-status-code

DSimple small library to check if a given number is an HTTP status code

0.2 2013-03-14 15:36 UTC

This package is auto-updated.

Last update: 2024-10-05 19:14:47 UTC


README

Simple small library to check if a given number is an HTTP status code.

Ever found yourself facing a number in your code and wondering whether it's a HTTP status code?

Problem solved!

The "Hello World" example

<?php
$this->assertTrue(\webignition\IsHttpStatusCode\IsHttpStatusCode::check(100));
$this->assertTrue(\webignition\IsHttpStatusCode\IsHttpStatusCode::check(301));
$this->assertTrue(\webignition\IsHttpStatusCode\IsHttpStatusCode::check(404));
$this->assertTrue(\webignition\IsHttpStatusCode\IsHttpStatusCode::check(503));

$this->assertFalse(\webignition\IsHttpStatusCode\IsHttpStatusCode::check(true));
$this->assertFalse(\webignition\IsHttpStatusCode\IsHttpStatusCode::check(false));
$this->assertFalse(\webignition\IsHttpStatusCode\IsHttpStatusCode::check('Hello World!'));