public function getRules($userAgent = null)
    {
        // return all rules
        if ($userAgent === null) {
            return $this->rules;
        }
        $this->setUserAgent($userAgent);
        if (isset($this->rules[$this->userAgentMatch])) {
            return $this->rules[$this->userAgentMatch];
        }
        $this->log[] = 'Rules not found for the given User-Agent';
        return array();
    }