public function EnsureFilterWorker::process

Processes an asset.

Parameters

AssetInterface $asset An asset:

Return value

AssetInterface|null May optionally return a replacement asset

Overrides WorkerInterface::process

File

drupal/core/vendor/kriswallsmith/assetic/src/Assetic/Factory/Worker/EnsureFilterWorker.php, line 50

Class

EnsureFilterWorker
Applies a filter to an asset based on a source and/or target path match.

Namespace

Assetic\Factory\Worker

Code

public function process(AssetInterface $asset) {
  if (self::CHECK_SOURCE === (self::CHECK_SOURCE & $this->flags) && preg_match($this->pattern, $asset
    ->getSourcePath()) || self::CHECK_TARGET === (self::CHECK_TARGET & $this->flags) && preg_match($this->pattern, $asset
    ->getTargetPath())) {
    $asset
      ->ensureFilter($this->filter);
  }
}