Move all assets in the list to the protected store

@param array $assets
488766
protected function protectAll($assets)
    {
        if (empty($assets)) {
            return;
        }
        $store = $this->getAssetStore();
        foreach ($assets as $asset) {
            $store->protect($asset['Filename'], $asset['Hash']);
        }
    }
142720
public function addAssets(array $assets)
    {
        foreach ($assets as $asset) {
            if (!is_array($asset)) {
                throw new \InvalidArgumentException('Each element needs to be an array.');
            }
            $this->addAsset($asset);
        }
    }
915832
public function createAction(Asset $asset): void
    {
        if ($this->persistenceManager->isNewObject($asset)) {
            $this->assetRepository->add($asset);
        }
        $this->addFlashMessage('assetHasBeenAdded', '', Message::SEVERITY_OK, [htmlspecialchars($asset->getLabel())]);
        $this->redirect('index');
    }
1079158
public function except($assets)
    {
        $assets = array_flatten(func_get_args());

        // Store the directory instance on a variable that we can inject into the scope of
        // the closure below. This allows us to call the path conversion method.
        $directory = $this;

        $this->assets = $this->assets->filter(function($asset) use ($assets, $directory)
        {
            $path = $directory->getPathRelativeToDirectory($asset->getRelativePath());

            return ! in_array($path, $assets);
        });

        return $this;
    }
393988
public function prepareAssets($assets_directory, \Smarty_Internal_Template $smarty)
    {
        // Be sure to use the proper path separator
        if (DS != '/') {
            $assets_directory = str_replace('/', DS, $assets_directory);
        }

        // Set the current template assets directory
        self::$assetsDirectory = $assets_directory;

        /** @var SmartyParser $smartyParser */
        $smartyParser = $smarty->smarty;

        $this->prepareTemplateAssets($smartyParser->getTemplateDefinition(), $assets_directory, $smartyParser);
    }
906504
public function onAfterDelete()
    {
        // Prepare blank manipulation
        $manipulations = new AssetManipulationList();

        // Add all assets for deletion
        $this->addAssetsFromRecord($manipulations, $this->owner, AssetManipulationList::STATE_DELETED);

        // Whitelist assets that exist in other stages
        $this->addAssetsFromOtherStages($manipulations);

        // Apply visibility rules based on the final manipulation
        $this->processManipulation($manipulations);
    }
539095
public function setAssetCollections(Collection $assetCollections)
    {
        foreach ($this->assetCollections as $existingAssetCollection) {
            $existingAssetCollection->removeTag($this);
        }
        foreach ($assetCollections as $newAssetCollection) {
            $newAssetCollection->addTag($this);
        }
        foreach ($this->assetCollections as $assetCollection) {
            if (!$assetCollections->contains($assetCollection)) {
                $assetCollections->add($assetCollection);
            }
        }
        $this->assetCollections = $assetCollections;
    }
1362749
protected function prepareAssets(array $assets)
    {
        if (!is_array($assets)) {
            $assets = [$assets];
        }

        /*
         * Split assets in to groups.
         */
        $combineJs = [];
        $combineCss = [];

        foreach ($assets as $asset) {
            /*
             * Allow aliases to go through without an extension
             */
            if (substr($asset, 0, 1) == '@') {
                $combineJs[] = $asset;
                $combineCss[] = $asset;
                continue;
            }

            $extension = File::extension($asset);

            if (in_array($extension, self::$jsExtensions)) {
                $combineJs[] = $asset;
                continue;
            }

            if (in_array($extension, self::$cssExtensions)) {
                $combineCss[] = $asset;
                continue;
            }
        }

        /*
         * Determine which group of assets to combine.
         */
        if (count($combineCss) > count($combineJs)) {
            $extension = 'css';
            $assets = $combineCss;
        }
        else {
            $extension = 'js';
            $assets = $combineJs;
        }

        /*
         * Apply registered aliases
         */
        if ($aliasMap = $this->getAliases($extension)) {
            foreach ($assets as $key => $asset) {
                if (substr($asset, 0, 1) !== '@') {
                    continue;
                }
                $_asset = substr($asset, 1);

                if (isset($aliasMap[$_asset])) {
                    $assets[$key] = $aliasMap[$_asset];
                }
            }
        }

        return [$assets, $extension];
    }
572632
public function setMoves($moves)
  {
    $moves = trim($moves);

    $this->moves = $moves;
    $this->movesCount = count(explode(' ', $moves));
  }
834036
public function removeAsset(Asset $asset): bool
    {
        if ($asset->getAssetCollections()->contains($this) === false) {
            $this->assets->removeElement($asset);
            return true;
        }
        return false;
    }
1299836
protected function fixAssets(array $assets)
    {
        $ignore = array('jquery-last.min.js',
                        'jquery-ui.min.js',
                        'jquery.easing-1.3.js',
                        'jquery.metadata.js',
                        'jquery.ui.position.js',);
        foreach ($assets as $key => $asset) {
            if (in_array(basename($asset), $ignore)) {
                unset($assets[$key]);
            }
        }

        return $assets;
    }
377403
protected function publishAll($assets)
    {
        if (empty($assets)) {
            return;
        }

        $store = $this->getAssetStore();
        foreach ($assets as $asset) {
            $store->publish($asset['Filename'], $asset['Hash']);
        }
    }
1091263
protected function orderAsset(Asset $asset, array &$assets)
    {
        $order = $asset->getOrder() and $order--;

        // If an asset already exists at the given order key then we'll add one to the order
        // so the asset essentially appears after the existing asset. This makes sense since
        // the array of assets has been reversed, so if the last asset was told to be first
        // then when we finally get to the first added asset it's added second.
        if (array_key_exists($order, $assets))
        {
            array_splice($assets, $order, 0, array(null));
        }

        $assets[$order] = $asset;

        ksort($assets);
    }
1077086
public function addPublicAsset($asset)
    {
        // Remove from protected / deleted lists
        $key = $this->getAssetKey($asset);
        unset($this->protected[$key]);
        unset($this->deleted[$key]);
        // Skip if already public
        if (isset($this->public[$key])) {
            return false;
        }
        unset($asset['Variant']);
        $this->public[$key] = $asset;
        return true;
    }
330015
public function setHeaders(array $values)
    {
        foreach ($values as $key => $value) {
            $this->setHeader($key, $value);
        }
    }
1097188
private function addAsset(AssetInterface $asset)
    {
        if ($asset instanceof FileAssetInterface) {
            $this->normalizeAsset($asset);
        }
        $this->assets[] = $asset;
    }
1301167
public function setLists($lists)
  {
    $this->lists=$lists;
    // update the storage, else we are out of sync
    $this->storage->updateLists($this->lists);
  }