From bed26b2fa5223498f60c863a25fd2f4fbef19c01 Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Sat, 11 Aug 2018 15:40:02 +0700 Subject: [PATCH] reduce str_replace in View/Parser::render() --- system/View/Parser.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/system/View/Parser.php b/system/View/Parser.php index 83f2eb25ff38..bfe20bfbfc12 100644 --- a/system/View/Parser.php +++ b/system/View/Parser.php @@ -129,12 +129,13 @@ public function render(string $view, array $options = null, $saveData = null): s $saveData = $this->config->saveData; } - $view = str_replace('.php', '', $view) . '.php'; + $template = str_replace('.php', '', $view); + $view = $template . '.php'; // Was it cached? if (isset($options['cache'])) { - $cacheName = $options['cache_name'] ?: str_replace('.php', '', $view); + $cacheName = $options['cache_name'] ?: $template; if ($output = cache($cacheName)) {