Url is from domain.

@param $url
@param $domain

@return array
12224
protected function isFromDomain($url, $domain)
    {
        if (!$domain) {
            return true;
        }

        $parsedUrl = parse_url($url);
        // if domain or subdomain
        if (
            isset($parsedUrl['host'])
            && (
                $parsedUrl['host'] == $domain
                || fnmatch('*.' . $domain, $parsedUrl['host'])
            )
        ) {
            return true;
        }

        return false;
    }
245158
public function listDNSRecords($domain)
    {
        $this->returnCode = 'no';
        $data = $this->send('v-list-dns-records', $this->userName, $domain, 'json');
        $data = json_decode($data, true);

        return $data;
    }
1248495
public function domain($domain = null)
    {
        if (is_null($domain)) {
            return $this->getDomain();
        }

        $this->action['domain'] = $domain;

        return $this;
    }
733210
public function retrieve($domain)
	{
		if (!($messages = Monster::eat($this->key($domain))))
		{
			$messages = array();
		}

		if (count($messages))
		{
			$this->clear($domain);
		}

		return $messages;
	}
596524
private static function domain(string $url): ?string
    {
        $domain = parse_url($url, PHP_URL_HOST);

        if (null !== $domain) {
            return implode('.', array_slice(explode('.', $domain), -2));
        }

        return null;
    }
1146885
public static function domainExists($domain) {

		if(false === is_string($domain)) {
			return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($domain)), E_USER_ERROR);
		}

		$routes = static :: getRoutes();

		foreach($routes as $route) {

			$domains = $route -> getDomain();

			if(true === is_array($domains)) {

				foreach($domains as $url) {

					if(preg_match('#'. str_replace('#', '\#', $url) .'#', $domain) || $url === $domain) {
						return true;
					}
				}
			}
		}

		return false;
	}
832585
protected function _matchDomain($domain)
    {
        $ret = array();

        foreach (array_keys($this->cookies) as $cdom) {
            if (Zend_Http_Cookie::matchCookieDomain($cdom, $domain)) {
                $ret[$cdom] = $this->cookies[$cdom];
            }
        }

        return $ret;
    }
668407
public static function replaceUrlAbstractToFullUrl($url, $domain = null)
    {

        if ($domain):
            $domain = (preg_match('/\/$/i', $domain) ? substr($domain, 0, -1) : $domain);
            $domain = str_replace(array("https://", "http://"), "", $domain);
            $domains = explode("/", $domain);
            $domain = "http://" . $domains[0];
            unset($domains[count($domains) - 1], $domains[0]);
            $count = count($domains);
        endif;

        if (preg_match('/^\/\//', $url) || preg_match('/^www\./', $url)):
            $url = 'http:' . (preg_match('/^www\./', $url) ? "//" : "") . $url;

        elseif ((preg_match('/^\//', $url) || preg_match('/^(\w|-)/i', $url)) && !preg_match('/^http:/i', $url) && $domain):
            $url = $domain . (!preg_match('/^\//', $url) ? "/" : "") . $url;

        elseif (preg_match('/^\.\./', $url) && $domain):
            if (preg_match_all('/\.\.\//i', $url, $matches) > 0):
                foreach ($matches[0] as $i => $t):
                    unset($domains[$count - $i]);
                endforeach;
            endif;

            $url = $domain . (!empty($domains) ? '/' . implode("/", $domains) : "") . '/' . str_replace('../', '', $url);

        elseif (preg_match('/^\./', $url) && $domain):
            $url = $domain . (isset($domains[1]) ? "/" . $domains[1] : "") . (isset($domains[2]) ? "/" . $domains[2] : "") . (isset($domains[3]) ? "/" . $domains[3] : "") . str_replace('./', "/", $url);
        endif;

        $testeHttp = explode("http", $url);
        if (isset($testeHttp[2])):
            $url = "http" . $testeHttp[count($testeHttp) - 1];
        endif;
        return $url;
    }
1125646
public function getUrlStatus($path, $domain = '')
    {

        $status = null;
        $url    = null;
        $uri    = empty($domain) ? $this->getDomain() : '';

        $hasSlash = strpos($path, '/');
        // add forward slash
        if($hasSlash === false) {
            $path = '/' . $path;
        }

        $url = $uri . $path;
        if($url) {
            stream_context_set_default(
                array(
                    'http' => array(
                        'method' => 'HEAD'
                    )
                )
            );

            $url    = get_headers($url, 1);
            $status = @explode(' ',$url[0]);

            if($status)
                $status = (int) $status[1];
        }


        return array(
            'status' => $status
        );
    }
390342
public static function isTemporaryDomain(string $domain): bool
    {
        if (self::$domainsTemporary === null) {
            self::$domainsTemporary = self::getData('domainsTemporary');
        }

        if (\in_array($domain, self::$domainsTemporary, true)) {
            return true;
        }

        if (\preg_match('/.*\.(?:tk|ml|ga|cf|gq)$/si', $domain)) {
            return true;
        }

        return false;
    }
1036595
public static function domainFromString($url)
    {
        $domain = parse_url($url, PHP_URL_HOST);
        if (preg_match('/(?P<domain>[a-z0-9][a-z0-9\-]{1,63}\.[a-z\.]{2,6})$/i', $domain, $regs)) {
            return $regs['domain'];
        }
        return false;
    }
103112
public function domain($domain = null)
    {
        deprecationWarning('Email::domain() is deprecated. Use Email::setDomain() or Email::getDomain() instead.');

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

        return $this->setDomain($domain);
    }
88005
private function getRootDomain($domain)
    {
        $domainParts = explode('.', $domain);
        $count       = count($domainParts);

        return $count > 1
            ? $domainParts[$count - 2].'.'.$domainParts[$count - 1]
            : $domainParts[0];
    }
274817
public function get(string $domain, string $path = '', string $name = null): array {
        $this->clearExpiredCookies();

        $path = $path === "" ? "/" : $path;
        $domain = \strtolower($domain);

        $matches = [];

        foreach ($this->cookies as $cookieDomain => $domainCookies) {
            if (!$this->matchesDomain($domain, $cookieDomain)) {
                continue;
            }

            foreach ($domainCookies as $cookiePath => $pathCookies) {
                if (!$this->matchesPath($path, $cookiePath)) {
                    continue;
                }

                foreach ($pathCookies as $cookieName => $cookie) {
                    if (!isset($name) || $name === $cookieName) {
                        $matches[] = $cookie;
                    }
                }
            }
        }

        return $matches;
    }
830977
public function extractShortUrl(string $url):array {
		$urls = [$url];

		while($url = $this->extract($url)){
			$urls[] = $url;
		}

		return $urls;
	}
52210
public function validationDomain($domain = null)
    {
        if ($domain === null) {
            return $this->_validationDomain;
        }
        $this->_validationDomain = $domain;
    }
506974
protected function processURL(string $url) : array
    {
        $url = trim($url, '/');
        $url_array = explode('/', $url);
        return $url_array;
    }