From ce39742ee923e5dcbb0b5ff28d4ae57262b1f7b8 Mon Sep 17 00:00:00 2001 From: Andreas Steiner Date: Mon, 10 Jun 2024 09:59:25 +0200 Subject: [PATCH] [TASK] #30517 Add magic function __call for get the mode with getMode() --- src/Settings.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/Settings.php b/src/Settings.php index 6ffaa7e..7530859 100644 --- a/src/Settings.php +++ b/src/Settings.php @@ -352,8 +352,17 @@ class Settings implements \Iterator, \Countable { unset( $this->settings[$name] ); } - // }}} - + + public function __call(string $name, array $arguments) + { + $type = substr($name, 0, 3); + if ($type === 'get') { + $propertyName = lcfirst(substr($name , 3)); + return (is_array( $this->settings[$propertyName] )) + ? $this->create( $this->settings[$propertyName] ) + : $this->settings[$propertyName]; } + } + } /* jEdit buffer local properties {{{