private function checkHostRule($rule)
    {
        if (!isset($this->url)) {
            $error_msg = 'Inline host directive detected. URL not set, result may be inaccurate.';
            $this->log[] = $error_msg;
            trigger_error("robots.txt: $error_msg", E_USER_NOTICE);
            return false;
        }
        $url = $this->parseURL($this->url);
        $host = trim(str_ireplace(self::DIRECTIVE_HOST . ':', '', mb_strtolower($rule)));
        if (in_array(
            $host, array(
                $url['host'],
                $url['host'] . ':' . $url['port'],
                $url['scheme'] . '://' . $url['host'],
                $url['scheme'] . '://' . $url['host'] . ':' . $url['port']
            )
        )) {
            $this->log[] = 'Rule match: ' . self::DIRECTIVE_HOST . ' directive';
            return true;
        }
        return false;
    }
private function checkHostRule($rule)
    {
        if (!isset($this->url)) {
            $error_msg = 'Inline host directive detected. URL not set, result may be inaccurate.';
            $this->log[] = $error_msg;
            trigger_error("robots.txt: $error_msg", E_USER_NOTICE);
            return false;
        }
        $url = $this->parseURL($this->url);
        $host = trim(str_ireplace(self::DIRECTIVE_HOST . ':', '', mb_strtolower($rule)));
        if (in_array(
            $host, array(
                $url['host'],
                $url['host'] . ':' . $url['port'],
                $url['scheme'] . '://' . $url['host'],
                $url['scheme'] . '://' . $url['host'] . ':' . $url['port']
            )
        )) {
            $this->log[] = 'Rule match: ' . self::DIRECTIVE_HOST . ' directive';
            return true;
        }
        return false;
    }
private function checkHostRule ( $ rule ) { if ( ! isset ( $ this -> url ) ) { $ error_msg = 'Inline host directive detected. URL not set, result may be inaccurate.' ; $ this -> log [ ] = $ error_msg ; trigger_error ( "robots.txt: $error_msg" , E_USER_NOTICE ) ; return false ; } $ url = $ this -> parseURL ( $ this -> url ) ; $ host = trim ( str_ireplace ( self :: DIRECTIVE_HOST . ':' , '' , mb_strtolower ( $ rule ) ) ) ; if ( in_array ( $ host , array ( $ url [ 'host' ] , $ url [ 'host' ] . ':' . $ url [ 'port' ] , $ url [ 'scheme' ] . '://' . $ url [ 'host' ] , $ url [ 'scheme' ] . '://' . $ url [ 'host' ] . ':' . $ url [ 'port' ] ) ) ) { $ this -> log [ ] = 'Rule match: ' . self :: DIRECTIVE_HOST . ' directive' ; return true ; } return false ; }
Check Host rule

@param  string $rule
@return bool
Check Host rule