/** * @return Asset[] */ public function getAssets() { if (null === $this->assets) { preg_match('/(\\@[a-zA-Z0-9\\-_\\.\\\\]+)/', $this->getSrc(), $match); $bundleName = $match ? $match[1] : ''; $prefixPath = $bundleName ? $this->getJarves()->resolvePath("{$bundleName}/Resources/public/") : ''; $offset = strlen($prefixPath); $path = $this->getJarves()->resolveInternalPublicPath($this->getSrc()); if (!$path) { return []; } $files = Finder::create()->name(basename($path))->files()->depth(!$this->getRecursive() ? '== 0' : null)->in(dirname($path))->sortByName(); foreach ($files as $file) { $asset = new Asset(null, $this->getJarves()); $file = ($bundleName ? $bundleName : '') . substr($file->getPathName(), $offset); $asset->setSrc($file); $asset->setType($this->getType()); $asset->setPriority($this->getPriority()); $asset->setCompression($this->getCompression()); $this->assets[] = $asset; } } return $this->assets; }