From 6de591a03dfbba732ea56e8694f5fc6eb4f0a76f Mon Sep 17 00:00:00 2001 From: Artem Vasilev Date: Tue, 5 Mar 2024 16:16:27 +0300 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8=D0=BB=20Tr?= =?UTF-8?q?ait=20=D0=B4=D0=BB=D1=8F=20=D1=80=D0=B0=D0=B1=D0=BE=D1=82=D1=8B?= =?UTF-8?q?=20=D1=81=20protected=20=D0=BF=D0=BE=D0=BB=D1=8F=D0=BC=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/Table/PropertyManagerTrait.php | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 com_oauthserver/administrator/src/Table/PropertyManagerTrait.php diff --git a/com_oauthserver/administrator/src/Table/PropertyManagerTrait.php b/com_oauthserver/administrator/src/Table/PropertyManagerTrait.php new file mode 100644 index 0000000..92a1c92 --- /dev/null +++ b/com_oauthserver/administrator/src/Table/PropertyManagerTrait.php @@ -0,0 +1,47 @@ +$name)) { + return $name; + } + + return null; + } + + public function __set($name, $value) + { + // All protected properties names must start with _ + if (str_starts_with($name, '_')) { + return; + } + + // If class has setter for property + $setterName = 'set' . CasesHelper::camelize($name, true); + if (method_exists($this, $setterName)) { + call_user_func([$this, $setterName], $value); + return; + } + + if (isset($this->$name)) { + $this->$name = $value; + } + } +} \ No newline at end of file