From ea128337d68cb26df2d8eafb3fa16c84aa692077 Mon Sep 17 00:00:00 2001 From: Kim Helge Frimanslund <1223194+kimhf@users.noreply.github.com> Date: Sun, 27 Oct 2019 18:05:57 +0100 Subject: [PATCH] Add magic isset to enable usage of isset() or empty() on context properties. --- src/Infrastructure/View/SimpleView.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/Infrastructure/View/SimpleView.php b/src/Infrastructure/View/SimpleView.php index d52e4e5..44e5833 100644 --- a/src/Infrastructure/View/SimpleView.php +++ b/src/Infrastructure/View/SimpleView.php @@ -221,6 +221,16 @@ public function __get( $property ) { return null; } + /** + * Magic isset to enable usage of isset() or empty() on context properties. + * + * @param string $property Property to check. + * @return bool + */ + public function __isset( $property ): bool { + return isset( $this->_context_[ $property ] ); + } + /** * Escape a value for output. *