Deprecated getStaticMember

This commit is contained in:
Marcos García de La Fuente 2014-07-22 04:12:45 +02:00
parent 76725c61ed
commit 31adeb7477

View File

@ -43,26 +43,15 @@ include_once DOL_DOCUMENT_ROOT .'/core/lib/json.lib.php';
* @param string $class Class name * @param string $class Class name
* @param string $member Name of property * @param string $member Name of property
* @return mixed Return value of static 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) function getStaticMember($class, $member)
{ {
if (is_object($class)) $class = get_class($class); if (isset($class::$member)) {
$classObj = new ReflectionClass($class); return $class::$member;
$result = null;
$found=0;
foreach($classObj->getStaticProperties() as $prop => $value)
{
if ($prop == $member)
{
$result = $value;
$found++;
break;
}
} }
if (! $found) dol_print_error('','Try to get a static member "'.$member.'" in class "'.$class.'" that does not exists or is not static.'); dol_print_error('','Try to get a static member "'.$member.'" in class "'.$class.'" that does not exists or is not static.');
return $result;
} }