Is URL external?
@param bool $localFile is the link from local file?
@return bool
772664
public function isExternal()
    {
        $parentLink = $this->parentLink;
        if($parentLink===null){ //parentLink is null in case of baseUrl
            return false;
        }
                    
        $isExternal = $this->getHost() !== "" && 
                    ($this->getHost() != $parentLink->getHost());
        
        return $isExternal;
    }
843676
public static function online(string $url): bool
    {
        $ch = curl_init($url);
        curl_setopt($ch, CURLOPT_NOBODY, true);
        curl_exec($ch);
        $code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
        curl_close($ch);
        if ($code === 200):
            return true;
        endif;

        return false;
    }
185127
function writeFileFromFile($filename, $localFilename, $multicall = false)
    {
        if (!file_exists($localFilename)) {
            throw new InvalidArgumentException('localFilename = ' . print_r($localFilename, true));
        }

        $contents = file_get_contents($localFilename);
        return $this->writeFile($filename, $contents, $multicall);
    }
1032123
protected function isLocalPath(string $path): bool
    {
        if (Str::startsWith($path, ['https://', 'http://', '//'])) {
            return false;
        }

        return \filter_var($path, FILTER_VALIDATE_URL) === false;
    }
235183
public function getLocalFile() {
		return preg_match('/^(http|https):\/\//', $this->url) ? $this->downloadFile() : \Yii::getAlias('@webroot' . $this->url);
	}
912734
protected function isLocalPath($path)
    {
        if (Str::startsWith($path, ['https://', 'http://', '//'])) {
            return false;
        }

        return (filter_var($path, FILTER_VALIDATE_URL) === false);
    }
639151
protected static function hasUrlDependencySupported($url)
    {
        $io = new NullIO();
        $config = new Config();

        /** @var VcsDriverInterface $driver */
        foreach (Assets::getVcsDrivers() as $driver) {
            $supported = $driver::supports($io, $config, $url);

            if ($supported) {
                return true;
            }
        }

        return false;
    }
593658
public function download(String $remotePath, String $localPath) : Bool
    {
        if( @ssh2_scp_recv($this->connect, $remotePath, $localPath) )
        {
            return true;
        }
        else
        {
            throw new FileRemoteDownloadException(NULL, $localPath);
        }
    }
1025800
private static function imageIsValid(Url $url, Url $baseUrl, $externalImages)
    {
        //base64 or same domain
        if ($url->getContent() !== null || $url->getDomain() === $baseUrl->getDomain()) {
            return true;
        }

        return is_bool($externalImages) ? $externalImages : $url->match($externalImages);
    }
1007788
protected static function loadLocaleResource($locale)
    {
        $translator = static::translator();
        if ($translator instanceof Translator) {
            foreach (static::getLocaleResourceFilepaths($locale) as $filepath) {
                if (is_readable($filepath)) {
                    $translator->addResource('array', require $filepath, $locale);

                    return true;
                }
            }

            return false;
        }

        return true;
    }
938330
public function get($remote_file = null, $local_file = null, $mode = FTP_ASCII)
    {
        if (\ftp_get($this->_stream, $local_file, $remote_file, $mode)) {
            return true;
        }

        $this->error = 'Failed to download file "'.$remote_file.'"';

        return false;
    }
1359749
public function findCachedFile( $url )
	{
		if ( ! $this->useCache ) return false;

		$path = str_replace( '//', '/', XBRL_Global::createPathFromUrl( $url, $this->cacheLocation ) );

		return file_exists( $path )
			? $path
			: false;
	}
1158627
public static function isUrl($input = false) {

        if ($input && !filter_var($input, FILTER_VALIDATE_URL) === false) {

            return true;
        }

        return false;
    }
429749
public function get($localFile, $remoteFile, $resumePosision = 0)
    {
        $mode = $this->getMode();
        $result = @ftp_get($this->connection, $localFile, $remoteFile, $mode, $resumePosision);

        if ($result === false)
        {
            throw new Exception(sprintf('Unable to get or save file "%s" from %s', $localFile, $remoteFile));
        }

        return $this;
    }
696161
function isLink( $filename = false )
    {
        if ( !$filename )
            $filename = $this->FileName;
        return $this->doIsLink( $filename );
    }
961803
def download_url(self, local_file):
        

        downloader = urllib.request.URLopener()
        downloader.retrieve(self.url, local_file)
1093321
public function getMediaUrl($sFile = '')
    {
        $oConfig = $this->getConfig();

        $sFilePath = $this->getMediaPath($sFile);

        if (!is_readable($sFilePath)) {
            return false;
        }

        if ($oConfig->isSsl()) {
            $sUrl = $oConfig->getSslShopUrl(false);
        } else {
            $sUrl = $oConfig->getShopUrl(false);
        }

        $sUrl = rtrim($sUrl, '/') . $this->_sMediaPath;

        if ($sFile) {
            return $sUrl . $sFile;
        }

        return $sUrl;
    }