/** * Get a filter collection for a specific target. * * @param MiniAsset\AssetTarget $target The target to get a filter collection for. * @param boolean $debug Indicates whether it is in debug or production mode * @return MiniAsset\Filter\FilterCollection */ public function collection(AssetTarget $target, $debug = false) { $filters = []; foreach ($target->filterNames() as $name) { $filter = $this->get($name); if ($filter === null) { throw new RuntimeException("Filter '{$name}' was not loaded/configured."); } // Clone filters so the registry is not polluted. $copy = clone $filter; $copy->settings(['target' => $target->name(), 'paths' => $target->paths()]); $filters[] = $copy; } return new FilterCollection($filters, $debug); }