getBasePath() публичный Метод

public getBasePath ( ) : null | string
Результат null | string
Пример #1
0
 public function testSetBasePath()
 {
     $url = '/~/jone/assets';
     $expected = trim($url, '/') . '/';
     $result = $this->object->setBasePath($url);
     $this->assertNull($result);
     $this->assertEquals($expected, $this->object->getBasePath());
 }
Пример #2
0
 /**
  * Get strategy to setup assets for given $renderer.
  *
  * @param \Zend\View\Renderer\RendererInterface $renderer
  * @throws Exception\DomainException
  * @throws Exception\InvalidArgumentException
  * @return \AsseticBundle\View\StrategyInterface|null
  */
 public function getStrategyForRenderer(Renderer $renderer)
 {
     if (!$this->hasStrategyForRenderer($renderer)) {
         return null;
     }
     $rendererName = $this->getRendererName($renderer);
     if (!isset($this->strategy[$rendererName])) {
         $strategyClass = $this->configuration->getStrategyNameForRenderer($rendererName);
         if (!class_exists($strategyClass, true)) {
             throw new Exception\InvalidArgumentException(sprintf('strategy class "%s" dosen\'t exists', $strategyClass));
         }
         $instance = new $strategyClass();
         if (!$instance instanceof StrategyInterface) {
             throw new Exception\DomainException(sprintf('strategy class "%s" is not instanceof "AsseticBundle\\View\\StrategyInterface"', $strategyClass));
         }
         $this->strategy[$rendererName] = $instance;
     }
     /** @var $strategy \AsseticBundle\View\StrategyInterface */
     $strategy = $this->strategy[$rendererName];
     $strategy->setBaseUrl($this->configuration->getBaseUrl());
     $strategy->setBasePath($this->configuration->getBasePath());
     $strategy->setDebug($this->configuration->isDebug());
     $strategy->setCombine($this->configuration->isCombine());
     $strategy->setRenderer($renderer);
     return $strategy;
 }