public static function filterAssetPath($asset, $path, array $config, array $options = []) {
		$config += ['assets' => null];

		if ($options['check'] || $options['timestamp']) {
			$file = static::path($asset, $options['type'], $options);
		}
		if ($options['check'] && !is_file($file)) {
			return false;
		}
		$isAbsolute = ($asset && $asset[0] === '/');

		if ($isAbsolute && $options['base'] && strpos($asset, $options['base']) !== 0) {
			$asset = "{$options['base']}{$asset}";
		} elseif (!$isAbsolute) {
			$asset = Text::insert(key($path), ['path' => $asset] + $options);
		}

		if (is_array($options['filter']) && !empty($options['filter'])) {
			$filter = $options['filter'];
			$asset = str_replace(array_keys($filter), array_values($filter), $asset);
		}

		if ($options['timestamp'] && is_file($file)) {
			$separator = (strpos($asset, '?') !== false) ? '&' : '?';
			$asset .= $separator . filemtime($file);
		}

		if ($host = $config['assets']) {
			$type = $options['type'];
			$env  = Environment::get();
			$base = isset($host[$env][$type]) ? $host[$env][$type] : null;
			$base = (isset($host[$type]) && !$base) ? $host[$type] : $base;

			if ($base) {
				return "{$base}{$asset}";
			}
		}
		return $asset;
	}
public static function filterAssetPath($asset, $path, array $config, array $options = []) {
		$config += ['assets' => null];

		if ($options['check'] || $options['timestamp']) {
			$file = static::path($asset, $options['type'], $options);
		}
		if ($options['check'] && !is_file($file)) {
			return false;
		}
		$isAbsolute = ($asset && $asset[0] === '/');

		if ($isAbsolute && $options['base'] && strpos($asset, $options['base']) !== 0) {
			$asset = "{$options['base']}{$asset}";
		} elseif (!$isAbsolute) {
			$asset = Text::insert(key($path), ['path' => $asset] + $options);
		}

		if (is_array($options['filter']) && !empty($options['filter'])) {
			$filter = $options['filter'];
			$asset = str_replace(array_keys($filter), array_values($filter), $asset);
		}

		if ($options['timestamp'] && is_file($file)) {
			$separator = (strpos($asset, '?') !== false) ? '&' : '?';
			$asset .= $separator . filemtime($file);
		}

		if ($host = $config['assets']) {
			$type = $options['type'];
			$env  = Environment::get();
			$base = isset($host[$env][$type]) ? $host[$env][$type] : null;
			$base = (isset($host[$type]) && !$base) ? $host[$type] : $base;

			if ($base) {
				return "{$base}{$asset}";
			}
		}
		return $asset;
	}
public static function filterAssetPath ( $ asset , $ path , array $ config , array $ options = [ ] ) { $ config += [ 'assets' => null ] ; if ( $ options [ 'check' ] || $ options [ 'timestamp' ] ) { $ file = static :: path ( $ asset , $ options [ 'type' ] , $ options ) ; } if ( $ options [ 'check' ] && ! is_file ( $ file ) ) { return false ; } $ isAbsolute = ( $ asset && $ asset [ 0 ] === '/' ) ; if ( $ isAbsolute && $ options [ 'base' ] && strpos ( $ asset , $ options [ 'base' ] ) !== 0 ) { $ asset = "{$options['base']}{$asset}" ; } elseif ( ! $ isAbsolute ) { $ asset = Text :: insert ( key ( $ path ) , [ 'path' => $ asset ] + $ options ) ; } if ( is_array ( $ options [ 'filter' ] ) && ! empty ( $ options [ 'filter' ] ) ) { $ filter = $ options [ 'filter' ] ; $ asset = str_replace ( array_keys ( $ filter ) , array_values ( $ filter ) , $ asset ) ; } if ( $ options [ 'timestamp' ] && is_file ( $ file ) ) { $ separator = ( strpos ( $ asset , '?' ) !== false ) ? '&' : '?' ; $ asset .= $ separator . filemtime ( $ file ) ; } if ( $ host = $ config [ 'assets' ] ) { $ type = $ options [ 'type' ] ; $ env = Environment :: get ( ) ; $ base = isset ( $ host [ $ env ] [ $ type ] ) ? $ host [ $ env ] [ $ type ] : null ; $ base = ( isset ( $ host [ $ type ] ) && ! $ base ) ? $ host [ $ type ] : $ base ; if ( $ base ) { return "{$base}{$asset}" ; } } return $ asset ; }
Performs checks and applies transformations to asset paths, including verifying that the
virtual path exists on the filesystem, appending a timestamp, prepending an asset host, or
applying a user-defined filter.

@see lithium\net\http\Media::asset()
@param string $asset A full asset path, relative to the public web path of the application.
@param mixed $path Path information for the asset type.
@param array $config The configuration array of the library from which the asset is being
loaded.
@param array $options The array of options passed to `asset()` (see the `$options` parameter
of `Media::asset()`).
@return mixed Returns a modified path to a web asset, or `false`, if the path fails a check.
Performs checks and applies transformations to asset paths including verifying that the virtual path exists on the filesystem appending a timestamp prepending an asset host or applying a user - defined filter .