diff --git a/src/PhpRenderer.php b/src/PhpRenderer.php index 001ea4d..f56927b 100644 --- a/src/PhpRenderer.php +++ b/src/PhpRenderer.php @@ -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; } @@ -131,7 +127,7 @@ public function getTemplatePath() */ public function setTemplatePath($templatePath) { - $this->templatePath = $templatePath; + $this->templatePath = rtrim($templatePath, '/\\') . '/'; } /**