Phrozn\Site\View\OutputPath\Entry::get PHP Method

get() public method

Get calculated path
public get ( ) : string
return string
    public function get()
    {
        $permalink = $this->getView()->getParam('this.permalink', null);
        if ($permalink === null) {
            return rtrim($this->getView()->getOutputDir(), '/') . '/' . ltrim($this->getRelativeFile('entries', false), '/') . '.html';
        }
        $class = 'Phrozn\\Site\\View\\OutputPath\\Entry\\' . ucfirst($permalink);
        if (!class_exists($class)) {
            $class = 'Phrozn\\Site\\View\\OutputPath\\Entry\\Parametrized';
        }
        $object = new $class($this->getView());
        return $object->get();
    }

Usage Example

Example #1
0
 public function testEntriesPaths()
 {
     $view = new View\Twig();
     $view->setInputFile('/var/www/phrozn-test/entries/some-entry.twig')->setOutputDir('/var/www/output');
     $path = new OutputPath\Entry($view);
     $this->assertSame('/var/www/output/some-entry.html', $path->get());
     $view->setInputFile('/var/www/phrozn-test/entries/sub/folder/some-entry.twig')->setOutputDir('/var/www/output');
     $path->setView($view);
     $this->assertSame('/var/www/output/sub/folder/some-entry.html', $path->get());
     $view->setInputFile('/var/www/phrozn-test/sub/folder/some-entry.twig')->setOutputDir('/var/www/output');
     $path->setView($view);
     $this->assertSame('/var/www/output/some-entry.html', $path->get());
 }
All Usage Examples Of Phrozn\Site\View\OutputPath\Entry::get
Entry