Asset Js
@param $name
@param $version
@return bool|string
9471
public static function assetJs($name, $version = false)
    {
        // Get cache
        $cache = Cache::get('potion_assets', []);

        // Check for asset
        if (!isset($cache[$name])) {
            return false;
        }

        // Url
        $url = self::assetUrl($name, $version);

        // Return
        return "<script type=\"text/javascript\" src=\"{$url}\"></script>";
    }
1126580
public static function downloadReleaseArchive(string $releaseName, string $version): bool
    {
        $archiveName = $releaseName . '.tar.gz';
        $archivePath = sprintf('%s/%s', Utilities::getBasePath(), $archiveName);
        $releaseUrl = sprintf(
            'https://github.com/editorconfig-checker/editorconfig-checker/releases/download/%s/%s',
            $version,
            $archiveName
        );

        $result = file_put_contents($archivePath, fopen($releaseUrl, 'r'));
        return $result > 0 || $result;
    }
444316
public function style_and_script($assets, $name, $path="", $cache=0, $version=false) {
        echo $this->script($assets, $name, $path, $cache, $version);
        echo $this->style($assets, $name, $path, $cache, $version);
    }
862133
public function publish($name)
    {
        if ($name instanceof Module) {
            $module = $name;
        } else {
            $module = $this->laravel['modules']->findOrFail($name);
        }

        with(new AssetPublisher($module))
            ->setRepository($this->laravel['modules'])
            ->setConsole($this)
            ->publish();

        $this->line("<info>Published</info>: {$module->getStudlyName()}");
    }
1301739
protected function getContentType($type, $version)
    {
        if ($type === 'css') {
            return 'text/css';
        } else if ($type === 'js') {
            return 'text/javascript';
        } else if ($type === 'image') {
            $fileExtension = pathinfo($version, PATHINFO_EXTENSION);
            
            if ($fileExtension === 'svg') {
                return 'image/svg+xml';
            } else if ($fileExtension === 'jpg') {
                return 'image/jpeg';
            } else if ($fileExtension === 'gif') {
                return 'image/gif';
            } else if ($fileExtension === 'png') {
                return 'image/png';
            }
        }
    }
498408
public static function toComponents(Version $version)
    {
        return array(
            Parser::MAJOR => $version->getMajor(),
            Parser::MINOR => $version->getMinor(),
            Parser::PATCH => $version->getPatch(),
            Parser::PRE_RELEASE => $version->getPreRelease(),
            Parser::BUILD => $version->getBuild()
        );
    }
1095920
public static function cleanPackageName($name)
    {
        if (preg_match('/^[a-z]+\-asset\//', $name, $matches)) {
            $name = substr($name, \strlen($matches[0]));
        }

        return $name;
    }
13198
public function add($name, Closure $callback = null)
    {
        try
        {
            $path = $this->finder->find($name);

            if (isset($this->assets[$path]))
            {
                $asset = $this->assets[$path];
            }
            else
            {
                $asset = $this->factory->get('asset')->make($path);

                $asset->isRemote() and $asset->raw();
            }

            is_callable($callback) and call_user_func($callback, $asset);

            return $this->assets[$path] = $asset;
        }
        catch (AssetNotFoundException $e)
        {
            $this->getLogger()->error(sprintf('Asset "%s" could not be found in "%s"', $name, $this->path));

            return $this->factory->get('asset')->make(null);
        }
    }
1267179
public function Link($name, $type, $version = 'latest')
    {
        $type = strtolower($type);

        //Gets data
        $data = $this->includeLibraryService->getData($name, $type, $version);

        //Returns the href or src part
        if (null !== $data) {
            return 'css' == $type ? $data['href'] : $data['src'];
        }

        //Throws an error if not found
        throw new Error('The Library "' . $name . ' (' . $type . ') version ' . $version . '" requested via "inc_link()" was not found. Please check name and supported library/versions.');
    }
1220948
public function generate($model, $version) {
		$operations = Configure::read('FileStorage.imageSizes.' . $model . '.' . $version);
		$options = [
			'overwrite' => !$this->params['keep-old-versions']
		];

		if (empty($operations)) {
			$this->out(__d('file_storage', 'Invalid table or version.'));
			$this->_stop();
		}

		try {
			$this->_loop('generate', $model, [$version => $operations], $options);
		} catch (Exception $e) {
			$this->abort($e->getMessage());
		}
	}
957233
public function getAssetID($name)
    {
        $list = $this->getAssetList();

        $list_json = json_decode($list, true);

        foreach ($list_json as $asset)
        {
            if ($asset['name'] == $name)
            {
                return $asset['id'];
            }
        }
        throw new \Exception('No asset found by name');
    }
42845
private function get_assets_version( $append_version, $q = 'v' ) {
		if ( ! $append_version ) {
			return '';
		}
		$append = trim( $this->apply_filters( 'assets_version' ) );
		if ( $append !== '' ) {
			if ( $q ) {
				return '?' . $q . '=' . $append;
			}

			return '?' . $append;
		}

		return '';
	}
751652
public function getLink(String $key, String $version = 'latest')
    {
        $return = $this->getLinks()[$key] ?? false;

        if( $version !== 'latest' )
        {
            return $this->versionModifier($version, $return);
        }

        return $return;
    }
76651
public function get($version = null, $up = true)
    {
        $currentVersion = $this->schemaTable->getCurrentVersion();
        if (null !== $version && false === $up && (int) $version > (int) $currentVersion) {
            return null;
        }

        $files = $this->getFiles($up);

        if (!$this->fileVersionExists($version, $this->getFiles($up))) {
            return null;
        }

        $migrationFiles = array();
        foreach ($files as $file) {
            $filenameParser = new FileNameParser($file->getFileName());
            $isMigrated = in_array($filenameParser->getVersion(), $this->schemaTable->getVersions());
            $migrationFile = new MigrationFile($filenameParser->getMigrationName(), $file->getRealpath(),
                $filenameParser->getVersion(), $filenameParser->getMigrationClassName(), $isMigrated);

            if (false === $this->statusIntention) {
                if ($up && $isMigrated || !$up && !$isMigrated) {
                    continue;
                }
                if ($version == $migrationFile->getVersion()) {
                    $migrationFiles[] = $migrationFile;
                    break;
                }
            }
            $migrationFiles[] = $migrationFile;
        }

        return $migrationFiles;
    }
13566
protected function printPendingVersion(Version $version, $style)
    {
        /** @var Version $version */
        $id = $version->getId();
        $reflectionClass = new \ReflectionClass($version->getMigration());
        $absolutePath = $reflectionClass->getFileName();
        $fileName = $absolutePath ? $this->getRelativePath(getcwd(), $absolutePath) : '';
        $this->output->writeln("\t<$style>[$id] $fileName</$style>");
    }
363013
public function setEnvProperty($name, $version)
    {
        if (! isset($this->data['env']) || ! is_array($this->data['env'])) {
            $this->data['env'] = [];
        }

        $this->data['env'][$name] = $version;
    }
1197410
public function script($src, $version=false){

        $list = [];

        foreach((array)$src as $script) {

            $type = 'text/javascript';
            $src  = $script;
            $load = '';

            if (is_array($script)) {
                extract($script);
            }

            $ispath = strpos($src, ':') !== false && !preg_match('#^(|http\:|https\:)//#', $src);
            $list[] = '<script src="'.($ispath ? $this->pathToUrl($src):$src).($version ? "?ver={$version}":"").'" type="'.$type.'" '.$load.'></script>';
        }

        return implode("\n", $list);
    }