From b8bc79e072cf58fd8459c7e4e5fcf9c01878dc2c Mon Sep 17 00:00:00 2001 From: Sami Mokaddem Date: Fri, 21 Jan 2022 09:07:21 +0100 Subject: [PATCH] new: [helper:valueGetter] Helper to help execute closure to get a value if needed --- src/View/Helper/ValueGetterHelper.php | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 src/View/Helper/ValueGetterHelper.php diff --git a/src/View/Helper/ValueGetterHelper.php b/src/View/Helper/ValueGetterHelper.php new file mode 100644 index 0000000..d64bb2f --- /dev/null +++ b/src/View/Helper/ValueGetterHelper.php @@ -0,0 +1,24 @@ +eval($target, $args); + } else { + $value = h($target); + } + return $value; + } + + private function eval($fun, $args=[]) + { + return $fun($args); + } +} \ No newline at end of file