mirror of
https://github.com/rmaake1/httpstatuses.git
synced 2024-09-03 16:19:48 +02:00
32 lines
765 B
PHP
32 lines
765 B
PHP
<?php
|
|
|
|
namespace Httpstatuses;
|
|
|
|
class Httpstatuses
|
|
{
|
|
public function statuses($class = "*")
|
|
{
|
|
$class_files = glob("codes/$class.json");
|
|
|
|
foreach($class_files as $class_file)
|
|
{
|
|
$class = json_decode(file_get_contents($class_file), true);
|
|
$classes[$class["class"]["class"]] = $class;
|
|
}
|
|
|
|
return $classes;
|
|
}
|
|
|
|
public function status($code)
|
|
{
|
|
$class = substr($code, 0, 1);
|
|
$class_file = file_get_contents("codes/$class.json");
|
|
|
|
if(!$class_file)
|
|
return false;
|
|
|
|
$code_list = json_decode($class_file, true);
|
|
|
|
return isset($code_list["codes"][$code]) ? $code_list["codes"][$code] : false;
|
|
}
|
|
} |