Skip to content

Commit

Permalink
Merge pull request #32 from vlakoff/templatePath
Browse files Browse the repository at this point in the history
Add leading slash if missing in setTemplatePath() too
  • Loading branch information
akrabat committed Oct 11, 2016
2 parents e6bf98a + 032429a commit 122ed12
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/PhpRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,7 @@ class PhpRenderer
*/
public function __construct($templatePath = "", $attributes = [])
{
$chr = substr($templatePath,-1);
if ($chr !== '/') {
$templatePath .= '/';
}
$this->templatePath = $templatePath;
$this->templatePath = rtrim($templatePath, '/\\') . '/';
$this->attributes = $attributes;
}

Expand Down Expand Up @@ -131,7 +127,7 @@ public function getTemplatePath()
*/
public function setTemplatePath($templatePath)
{
$this->templatePath = $templatePath;
$this->templatePath = rtrim($templatePath, '/\\') . '/';
}

/**
Expand Down

0 comments on commit 122ed12

Please sign in to comment.