/**
  * @param string $path
  *
  * @return string
  */
 public function getUrl($path)
 {
     if (isset($this->bundleDir)) {
         $path = '/' . $this->bundleDir . '/' . self::THEMES_FOLDER . '/' . ltrim($path, '/');
     }
     return parent::getUrl($path);
 }
Esempio n. 2
0
 /**
  * @param string                   $basePath        The base path to be prepended to relative paths
  * @param VersionStrategyInterface $versionStrategy The version strategy
  */
 public function __construct($basePath, VersionStrategyInterface $versionStrategy, ContextInterface $context = null)
 {
     parent::__construct($versionStrategy, $context);
     if (!$basePath) {
         $this->basePath = '/';
     } else {
         if ('/' != $basePath[0]) {
             $basePath = '/' . $basePath;
         }
         $this->basePath = rtrim($basePath, '/') . '/';
     }
 }
 /**
  * @param string|string[]          $baseUrls        Base asset URLs
  * @param VersionStrategyInterface $versionStrategy The version strategy
  * @param ContextInterface|null    $context         Context
  */
 public function __construct($baseUrls, VersionStrategyInterface $versionStrategy, ContextInterface $context = null)
 {
     parent::__construct($versionStrategy, $context);
     if (!is_array($baseUrls)) {
         $baseUrls = (array) $baseUrls;
     }
     if (!$baseUrls) {
         throw new LogicException('You must provide at least one base URL.');
     }
     foreach ($baseUrls as $baseUrl) {
         $this->baseUrls[] = rtrim($baseUrl, '/');
     }
     $sslUrls = $this->getSslUrls($baseUrls);
     if ($sslUrls && $baseUrls !== $sslUrls) {
         $this->sslPackage = new self($sslUrls, $versionStrategy);
     }
 }
 public function testGetVersion()
 {
     $package = new Package(new StaticVersionStrategy('v1'));
     $this->assertEquals('v1', $package->getVersion('/foo'));
 }