protected function getDomain()
    {
        if ($this->domain !== null) {
            return $this->domain;
        }

        if (PHP_SAPI == 'cli') {
            $this->domain = '__CLI__';
            return $this->domain;
        }

        $this->domain = isset($_SERVER['SERVER_NAME'])? $_SERVER['SERVER_NAME'] : 'default';
        return $this->domain;
    }