Returns the assets version with the appropriate tag.

@param $file

@return string
544719
public function withTag($file)
    {
        $extension = pathinfo($file, PATHINFO_EXTENSION);

        try {
            $manifest = $this->readManifestFile();
        } catch (\Exception $e) {
            return $file;
        }

        // if no manifest, return the regular asset
        if (!$manifest) {
            if ($extension == 'js') {
                return '<script src="' . $this->buildPath . '/' . $file . '"></script>';
            }

            return '<link rel="stylesheet" href="' . $file . '">';
        }

        if ($extension == 'js') {
            return '<script src="' . $this->buildPath . '/' . $manifest[$file] . '"></script>';
        }

        return '<link rel="stylesheet" href="' . $this->buildPath . '/' . $manifest[$file] . '">';
    }
933462
public static function pathInfo($file)
    {
        $result = self::_pathInfo($file);
        return self::i()->dump($result, '! pathInfo (' . $file . ') !');
    }
1087556
protected function file_mod($file)
    {
        $fs  = false;
        $ext = substr($file, strrpos($file, '.') + 1);

        // use minified file if exists (not in development mode)
        if (!$this->devel_mode && !preg_match('/\.min\.' . $ext . '$/', $file)) {
            $minified_file = substr($file, 0, strlen($ext) * -1) . 'min.' . $ext;
            if ($fs = @filemtime($this->assets_dir . $minified_file)) {
                return $minified_file . '?s=' . $fs;
            }
        }

        if ($fs = @filemtime($this->assets_dir . $file)) {
            $file .= '?s=' . $fs;
        }

        return $file;
    }
73495
public function mix($file, $tag = false, $inline = false)
    {
        if ($tag) {
            return Mix::$plugin->mix->withTag($file, $inline);
        }

        return Mix::$plugin->mix->version($file);
    }
519935
public function fileIsIgnored($file)
    {
        $line = $this->ignoreFile[0];
        $mode = 'regexp';
        $ignored = false;
        if (preg_match('#^syntax\s*:\s*(glob|regexp)$#', $line, $matches)
            || $matches[1] === 'glob'
        ) {
            $mode = 'glob';
        }
        if ($mode === 'glob') {
            $ignored = $this->ignoredByGlob($file);
        } elseif ($mode === 'regexp') {
            $ignored = $this->ignoredByRegex($file);
        }
        return $ignored;
    }
1309760
public function getAsseticVersionUrl($url)
    {
        $tmp = $this->getParameter('assetic_versions');

        if ($tmp && is_array($tmp)) {
            $tmpUrl = basename($url);
            $url .= '?'.(isset($tmp[$tmpUrl]) && $tmp[$tmpUrl] ? $tmp[$tmpUrl] : (isset($tmp['global']) ? $tmp['global'] : ''));
        }

        return $url;
    }
533137
public function getDiffFile($file)
    {
        $args = [
            '-r', '-p', '-m', '-M', '--no-commit-id', '--full-index', $this->revision,
            '--', $this->repository->getWikiDir().$file,
        ];

        $diff = Diff::parse($this->repository->run('diff-tree', $args));
        $diff->setRepository($this->repository);

        return $diff;
    }
566984
public function mix($file, $tag = false)
    {
        if ($tag) {
            return Mix::$plugin->mixService->withTag($file);
        }
        return Mix::$plugin->mixService->version($file);
    }
929961
public static function getUniqueCode($file)
    {
        if (!$file) {
            return null;
        }

        $hash = md5($file->file_name . '!' . $file->disk_name);
        return base64_encode($file->id . '!' . $hash);
    }
796000
public static function read(string $file = ''): string
    {
        $result = false;
        $file = static::normalizePath($file);

        if (static::exists($file)) {
            $result = @\file_get_contents($file);
        }

        return $result;
    }
548555
public function withTag($file, $inline = false)
    {
        $versionedFile = $this->version($file);
        $extension = pathinfo($file, PATHINFO_EXTENSION);

        if ($inline) {
            $versionedFile = strtok($versionedFile, '?');
            $absoluteFile = implode('/', array_filter([
                $this->rootPath,
                $this->publicPath,
                ltrim($versionedFile, '/')
            ]));
            if (file_exists($absoluteFile)) {
                $content = file_get_contents($absoluteFile);

                if ($extension === 'js') {
                    return '<script>' . $content . '</script>';
                }

                return '<style>' . $content . '</style>';
            }
        }

        if ($extension === 'js') {
            return '<script src="' . $versionedFile . '"></script>';
        }

        return '<link rel="stylesheet" href="' . $versionedFile . '">';
    }
806740
static public function getFileExt($file)
    {
        $s = strrchr($file, '.');
        if ($s === false)
        {
            return false;
        }
        return strtolower(trim(substr($s, 1)));
    }
285777
public function render( $file = '' ) {
		reset( $this->assets[ $this->type ] );
		//reset($this->attr[$this->type]);
		$attr = '';

		if ( $this->type == 'js' ) {

			if ( $file != '' ) {
				$key     = array_search( $file, $this->assets[ $this->type ] );
				$version = $this->versions[ $this->type ][ $key ];
				$asset   = $this->assets[ $this->type ][ $key ];

				if ( preg_match( "/\b(?:(?:https?|ftp):\/\/|www\.)[-a-z0-9+&@#\/%?=~_|!:,.;]*[-a-z0-9+&@#\/%=~_|]/i", $asset ) ) {
					$asset_url = $asset;
				} else {
					$asset_url = $this->BaseUrl . Config::get( 'path.assets' ) . "/$this->type/" . $asset . '.' .
					             $this->type . $version;
				}

				while ( list( $at, $val ) = each( $this->attr[ $this->type ][ $key ] ) ) {
					$attr .= $at . '="' . $val . '" ';
				}

				if ( $key ) {
					return '<script type="text/javascript" src="' . $asset_url . '" ' . $attr . '></script>' . "\n";
				}

			} else {
				$render = '';

				while ( list( $key, $value ) = each( $this->assets[ $this->type ] ) ) {
					$asset   = $this->assets[ $this->type ][ $key ];
					$version = $this->versions[ $this->type ][ $key ];

					if ( preg_match( "/\b(?:(?:https?|ftp):\/\/|www\.)[-a-z0-9+&@#\/%?=~_|!:,.;]*[-a-z0-9+&@#\/%=~_|]/i", $asset ) ) {
						$asset_url = $asset;
					} else {
						$asset_url = $this->BaseUrl . Config::get( 'path.assets' ) . "/$this->type/" . $asset . '.' .
						             $this->type . $version;
					}

					$attr = '';

					while ( list( $at, $val ) = each( $this->attr[ $this->type ][ $key ] ) ) {
						$attr .= $at . '="' . $val . '" ';
					}

					$render .= '<script type="text/javascript" src="' . $asset_url . '" ' . $attr . '></script>' . "\n";
				}

				return $render;
			}

		} elseif ( $this->type == 'css' ) {

			if ( $file != '' ) {
				$key     = array_search( $file, $this->assets[ $this->type ] );
				$asset   = $this->assets[ $this->type ][ $key ];
				$version = $this->versions[ $this->type ][ $key ];

				if ( preg_match( "/\b(?:(?:https?|ftp):\/\/|www\.)[-a-z0-9+&@#\/%?=~_|!:,.;]*[-a-z0-9+&@#\/%=~_|]/i", $asset ) ) {
					$asset_url = $asset;
				} else {
					$asset_url = $this->BaseUrl . Config::get( 'path.assets' ) . "/$this->type/" . $asset . '.' .
					             $this->type . $version;
				}

				while ( list( $at, $val ) = each( $this->attr[ $this->type ][ $key ] ) ) {
					$attr .= $at . '="' . $val . '" ';
				}

				if ( $key ) {
					return '<link rel="stylesheet" href="' . $asset_url . '" ' . $attr . ' />' . "\n";
				}

			} else {
				$render = '';

				while ( list( $key, $value ) = each( $this->assets[ $this->type ] ) ) {
					$attr    = '';
					$asset   = $this->assets[ $this->type ][ $key ];
					$version = $this->versions[ $this->type ][ $key ];

					if ( preg_match( "/\b(?:(?:https?|ftp):\/\/|www\.)[-a-z0-9+&@#\/%?=~_|!:,.;]*[-a-z0-9+&@#\/%=~_|]/i", $asset ) ) {
						$asset_url = $asset;
					} else {
						$asset_url = $this->BaseUrl . Config::get( 'path.assets' ) . "/$this->type/" . $asset . '.' .
						             $this->type . $version;
					}

					while ( list( $at, $val ) = each( $this->attr[ $this->type ][ $key ] ) ) {
						$attr .= $at . '="' . $val . '" ';
					}

					$render .= '<link rel="stylesheet" href="' . $asset_url . '" ' . $attr . ' />' . "\n";
				}

				return $render;
			}
		}

	}
305010
public function getPath($file)
    {
        $file = "/".ltrim($file,"/");

        $best = null;
        foreach($this->nodes as $node) {
            $mount = $node->getMountPoint();
            if (strncmp($mount, $file, strlen($mount)) === 0) {
                $nodefile = substr($file, strlen($mount));
                //printf("nodefile=%s mount=%s file=%s\n", $nodefile, $mount, $file);
                if ($node->has($nodefile)) {
                    return $node->getPath($nodefile);
                }
                if (!$best) {
                    $best = $node->getPath($nodefile);
                }
                if ($node->getIsWritable($nodefile)) {
                    $best = $node->getPath($nodefile);
                }
            }
        }
        return $best;

    }
758459
public function get_mime($file){
        $type = $this->get_content_type($file);
        if( $type ){
            $type = array_map('trim', explode(';', $type));
            return $type[0];
        }else{
            return '';
        }
    }
341031
public function cssVersion($fileName)
    {
        $filePath = sprintf("%s/../web%s", $this->kernelRootDir, $fileName);

        if (true === file_exists($filePath)) {
            return sprintf("%s?v=%s", $fileName, substr(md5_file($filePath), 0, 5));
        }

        return sprintf("%s?v=%s", $fileName, substr(sha1(microtime()), 0, 6));
    }
1044241
public function version($file)
    {
        if (file_exists($this->assetFullPath . '/hot')) {
            return '//localhost:8080/' . $file;
        }

        try {
            $manifest = $this->readManifestFile();
        } catch (Exception $e) {
            Craft::info('Mix: ' . printf($e->getMessage()), __METHOD__);
        }

        $fileKey = '/' . ltrim($file, '/');
        if (is_array($manifest) && isset($manifest[$fileKey])) {
            $file = $manifest[$fileKey];
        }

        return '/' . implode('/', array_filter([
            $this->assetPath,
            ltrim($file, '/')
        ]));
    }