public static function objectToArray($OBJ)
    {
        if (is_object($OBJ)) {
            // Gets the properties of the given object with get_object_vars function
            $OBJ = get_object_vars($OBJ);
        }
        if (is_array($OBJ)) {
            // Return array converted to object using __FUNCTION__ (Magic constant) for recursive call in THIS object class type
            return array_map([get_called_class(), __FUNCTION__], $OBJ);
        }

        return $OBJ;
    }