From e8ff6c9532a3b024c0b15caadd8490e99a831690 Mon Sep 17 00:00:00 2001 From: Awilum Date: Wed, 29 May 2019 00:37:24 +0300 Subject: [PATCH] Slim Framework integration #118 #117 - Snippets: refactoring --- flextype/Snippets.php | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/flextype/Snippets.php b/flextype/Snippets.php index d44df4d8..ec362a7a 100644 --- a/flextype/Snippets.php +++ b/flextype/Snippets.php @@ -86,9 +86,8 @@ class Snippets // If there is any snippets file then go... if (count($_snippets) > 0) { foreach ($_snippets as $snippet) { - if ($snippet['type'] == 'file' && $snippet['extension'] == 'json') { - $snippet_content = JsonParser::decode(Filesystem::read($snippet['path'])); - $snippet[$snippet['basename']] = $snippet_content['title']; + if ($snippet['type'] == 'file' && $snippet['extension'] == 'php') { + $snippet[$snippet['basename']] = $snippet['basename']; } } } @@ -232,4 +231,15 @@ class Snippets { return PATH['snippets'] . '/' . $id . '.php'; } + + /** + * Helper method _dir_location + * + * @access private + * @return string + */ + private function _dir_location() : string + { + return PATH['snippets'] . '/'; + } }