Set the cache (if any) on the asset, and return the new AssetCache.

@param string         $path  Path to asset
@param AssetInterface $asset Assetic Asset Interface

@return  AssetCache
423768
public function setCache($path, AssetInterface $asset)
    {
        $provider = $this->getProvider($path);

        if (!$provider instanceof CacheInterface) {
            return $asset;
        }

        $assetCache             = new AssetCache($asset, $provider);
        $assetCache->mimetype   = $asset->mimetype;

        return $assetCache;
    }
260516
public function get (Asset $asset) : Asset
    {
        $cache = $this->locator->get(AssetsCache::class);
        $cachedAsset = $cache->get($asset);

        if (null !== $cachedAsset)
        {
            return $cachedAsset;
        }

        return $this->addAsset($asset);
    }
806002
public function cacheDir(string $path): self
    {
        $this->validatePathIsRelativeToProject($path, __METHOD__);
        $this->cacheDir = rtrim($path, '/');

        return $this;
    }
750176
public function asset($path, $secure = null)
    {
        if ($this->isValidUrl($path)) {
            return $path;
        }

        // Once we get the root URL, we will check to see if it contains an index.php
        // file in the paths. If it does, we will remove it since it is not needed
        // for asset paths, but only for routes to endpoints in the application.
        $root = $this->newGetRootUrl($this->getScheme($secure));

        return $this->removeIndex($root).'/'.trim($path, '/');
    }
1221692
public function moduleAsset($module, $path, $contentType = 'null')
    {
        $assetPath = base_path(Config::get('cms.module-directory').'/'.ucfirst($module).'/Assets/'.$path);

        if (!is_file($assetPath)) {
            $assetPath = config('cms.modules.'.$module.'.asset_path').'/'.$path;
        }

        return url(config('cms.backend-route-prefix', 'cms').'/asset/'.CryptoServiceFacade::url_encode($assetPath).'/'.CryptoServiceFacade::url_encode($contentType).'/?isModule=true');
    }
954689
public function setCachePath($path)
    {
        if (@file_exists($path) && is_dir($path)) {
            $this->cache_path = realpath($path).'/';
        } elseif (null!==$path_rp = $this->findRealPath($path)) {
            $this->cache_path = rtrim($path_rp, '/').'/';
        } else {
            throw new \InvalidArgumentException(
                sprintf('Cache path "%s" was not found or is not a directory!', $path)
            );
        }
        return $this;
    }
918265
public function getForAsset(AssetInterface $asset)
    {
        $sourceRoot = $asset->getSourceRoot();
        if (!isset($this->bundleMap[$sourceRoot])) {
            throw new \Exception('Could not map the asset to a bundle');
        }

        // get the relative path
        $templateName = $asset->getSourcePath();
        // by convention, all symfony views are in Resources/views/, therefore remove this segment
        $templateName = str_replace('Resources/views/', '', $templateName);
        // remove the .ng extension (our convention)
        $templateName = str_replace('.ng', '', $templateName);
        // prepend bundle name
        $bundleName = $this->bundleMap[$sourceRoot];
        $templateName = sprintf('%s/%s', $bundleName, $templateName);

        return $templateName;
    }
8467
public function setPath($type, $path)
	{
		if (!array_key_exists($type, $this->paths))
		{
			throw new \Exception(\App::get('language')->txt('Unknown asset path type of %s given.', $type));
		}

		$path = trim((string) $path);

		// Add separators as needed
		$path = DS . trim($path, DS);

		// Add to list of paths
		$this->paths[$type] = $path;

		return $this;
	}
409739
public function remove($path)
    {
        $key = $this->getCacheKey($path);

        unset($this->data[$key]);

        return $this;
    }
174074
public function setRootPath($path) {

		$path = rtrim($path, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR;

		if(!is_null($this->absoluteAssetsPath) && 0 !== strpos($this->absoluteAssetsPath, $path)) {
			throw new ApplicationException("'$path' not a parent of assets path '{$this->absoluteAssetsPath}'", ApplicationException::PATH_MISMATCH);
		}

		$this->rootPath = $path;
		$this->relativeAssetsPath = str_replace(DIRECTORY_SEPARATOR, '/', str_replace($this->rootPath, '', (string) $this->absoluteAssetsPath));

		return $this;

	}
494658
public function setCache($cache, $path, $reload = true)
    {
        $this->_cache        = (bool) $cache;
        $this->_cache_path   = $path;
        $this->_caceh_reload = $reload;

        return $this;
    }
838205
public function setCachePath($path) {
		$path = rtrim($path, DIRECTORY_SEPARATOR);
		$path = realpath($path);
		
		if ($path === false) {
			throw new NoPath('Invalid path: "' . func_get_arg(0) . '"');
		}
		
		if (! is_dir($path)) {
			throw new NoPath('Path must be a directory: "' . $path . '"');
		}
		
		if (! is_writeable($path)) {
			throw new NoPath('Path must be a writable: "' . $path . '"');
		}
		
		$this->path = $path;
	}
654923
public function importedAsset($path, $parameters = array())
  {
    if ($this->useController) {
      $path = $this->router->generate(
        "_assetic_" . $this->res->getFormulaeName($path),
        $parameters
      );
    } else {
      $path = $this->assets->getAssetUrl(
        ltrim($path, "/")
      );
    }

    return $path;
  }
1135934
public function set($index, AssetInterface $asset)
    {
        $this->data[$index] = $asset;
        $this->provides[]   = $asset->is();
        return $this;
    }
237977
public function newAsset($asset, $group = null, $content = '')
    {
        return $this->registry->newAsset($asset, $group, $content)
                              ->setRenderer($this->renderer);
    }
684818
public function assetAction($path, $file, Request $request)
    {
        $filePath = $this->getAssetsDir() . '/' . $path . '/' . $file;

        if (!file_exists($filePath)) {
            return new Response($filePath . ' not found', 404);
        }

        $response = new Response();
        $response->setPublic();
        $response->headers->addCacheControlDirective('must-revalidate', true);

        $lastModified = filemtime($filePath);

        $response->setETag(md5($filePath . $lastModified));
        $response->setLastModified(new \DateTime('@' . $lastModified));

        if ($response->isNotModified($request)) {
            // return the 304 Response immediately
            return $response;
        }

        $mime = $this->getMime($filePath);
        if ($mime !== null) {
            $response->headers->set('Content-Type', $mime);
        }

        return $response->setContent(file_get_contents($filePath));
    }
1163951
public static function getInstanceByPath($path, $cacheDir = '')
    {
        $instance = new self();

        $instance->pathFile = $path;

        if (!empty($cacheDir)) {
            $instance->setCacheDir($cacheDir);
            $instance->setCachePath();
        }

        $instance->readImage();

        return $instance;
    }