Bolt\Asset\File\Queue::add PHP Method

add() public method

Add a file asset to the queue.
public add ( Bolt\Asset\File\FileAssetInterface $asset )
$asset Bolt\Asset\File\FileAssetInterface
    public function add(FileAssetInterface $asset)
    {
        if (!$asset->getPackageName()) {
            // Deprecated.
            $asset->setPackageName('extensions');
        }
        $url = $this->packages->getUrl($asset->getPath(), $asset->getPackageName());
        $asset->setUrl($url);
        if ($asset->getType() === 'javascript') {
            $this->javascript[$url] = $asset;
        } elseif ($asset->getType() === 'stylesheet') {
            $this->stylesheet[$url] = $asset;
        } else {
            throw new \InvalidArgumentException(sprintf('Requested asset type %s is not valid.', $asset->getType()));
        }
    }