* @package Mammut\Protocol */ class Request extends \Mammut\StrictObject { private $host = false; private $agent = false; private $acceptEnc = false; private $acceptLanguage = false; private $acceptCharset = false; public function getHost() { if($this->host) return $this->host; else return $_SERVER['HTTP_HOST']; } public function getAgent() { if($this->agent) return $this->agent; else return $_SERVER['HTTP_USER_AGENT']; } public function getAcceptedEncoding() { if($this->acceptEnc) return $this->acceptEnc; else return explode(',', $_SERVER['HTTP_ACCEPT_ENCODING']); } public function getAcceptedCharset() { if($this->acceptCharset) return $this->acceptCharset; else return explode(',', $_SERVER['HTTP_ACCEPT_CHARSET']); } public function getAcceptedLanguage() { if($this->acceptLanguage) return $this->acceptLanguage; else return explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']); } public function __toString() { $st = "Host: {$this->host}\n"; $st .= "Accept-Encoding: " . implode(',', $this->getAcceptedEncoding()) . "\n"; $st .= "Accept-Language: " . implode(',', $this->getAcceptedLanguage()) . "\n"; $st .= "Accept-Charset: " . implode(',', $this->getAcceptedCharset()); return $st; } }