/** * @param string $uri * @param array|null $headers OPTIONAL * @param array|null $server * @param CM_Model_User|null $viewer */ public function __construct($uri, array $headers = null, array $server = null, CM_Model_User $viewer = null) { if (null !== $headers) { $this->_headers = array_change_key_case($headers); } if (null !== $server) { $this->_server = array_change_key_case($server); } $this->setUri($uri); if ($sessionId = $this->getCookie('sessionId')) { if ($this->_session = CM_Session::findById($sessionId)) { $this->_session->start(); } } if ($viewer) { $this->_viewer = $viewer; } self::$_instance = $this; }
/** * @param string $uri * @param array|null $headers OPTIONAL * @param array|null $server * @param CM_Model_User|null $viewer * @throws CM_Exception * @throws CM_Exception_Invalid */ public function __construct($uri, array $headers = null, array $server = null, CM_Model_User $viewer = null) { if (null !== $headers) { $this->_headers = array_change_key_case($headers); } if (null !== $server) { foreach ($server as &$serverValue) { if (is_string($serverValue)) { $serverValue = CM_Util::sanitizeUtf($serverValue); } } $this->_server = array_change_key_case($server); } $uri = CM_Util::sanitizeUtf((string) $uri); $this->setUri($uri); if ($sessionId = $this->getCookie('sessionId')) { $this->setSession(CM_Session::findById($sessionId)); } if ($viewer) { $this->_viewer = $viewer; } self::$_instance = $this; }