private static function loadfile() { if (!empty(self::$translation) && isset(self::$translation)) { return; } else { self::$filename = __ROOT__ . "/config/statuscode.ini"; self::$translation = parse_ini_file(self::$filename); } }
protected function isMethod() { $str = Config::getConfig('method'); $methods = explode(',', $str); if (!in_array($this->request->method, $methods)) { $message = StatusCodeManager::getTranslation('405'); throw new ZebraStatusException($message, '405'); } }
public function handle($header) { $this->setRequest($header); $this->isHTTP(); $this->isMethod(); $translate = StatusCodeManager::getTranslation('200'); $this->response->setFirstLine("HTTP", "1.0", "200", $translate); $response = $this->response->getDynamicResponse(); $body = $this->getBody(); $packet = $response . $body; return $packet; }
public function handle($header) { echo 'static'; $this->setRequest($header); $this->isHTTP(); $this->isMethod(); $this->getBody(); $this->response->contentLength = strlen($this->body); $extension = $this->request->getExtension(); $mime = Config::getConfig($extension); if (!isset($mime) || empty($mime)) { $message = StatusCodeManager::getTranslation('415'); throw new ZebraStatusException($message, 415); } $this->response->contentType = $mime; $translate = StatusCodeManager::getTranslation('200'); $this->response->setFirstLine("HTTP", "1.0", "200", $translate); $response = $this->response->getStaticResponse(); $body = $this->getBody(); $packet = $response . chr(13) . chr(10) . $body; return $packet; }
protected function isReadable($file) { if (file_exists($file) && is_readable($file)) { return true; } $message = StatusCodeManager::getTranslation('404'); throw new ZebraStatusException($message, '404'); }