From 31adeb7477969913b59ba92eb9ee58e0290791be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Tue, 22 Jul 2014 04:12:45 +0200 Subject: [PATCH] Deprecated getStaticMember --- htdocs/core/lib/functions.lib.php | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 6395bd77d34..87ee457fa7d 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -43,26 +43,15 @@ include_once DOL_DOCUMENT_ROOT .'/core/lib/json.lib.php'; * @param string $class Class name * @param string $member Name of property * @return mixed Return value of static property + * @deprecated PHP 5.3 is now the minimum requirement, this is no longer necessary */ function getStaticMember($class, $member) { - if (is_object($class)) $class = get_class($class); - $classObj = new ReflectionClass($class); - $result = null; - - $found=0; - foreach($classObj->getStaticProperties() as $prop => $value) - { - if ($prop == $member) - { - $result = $value; - $found++; - break; - } + if (isset($class::$member)) { + return $class::$member; } - if (! $found) dol_print_error('','Try to get a static member "'.$member.'" in class "'.$class.'" that does not exists or is not static.'); - return $result; + dol_print_error('','Try to get a static member "'.$member.'" in class "'.$class.'" that does not exists or is not static.'); }