CBPAllTrackingService :: parseStringParameterMatches: Bitrix method

      
<?php 
//  CBPAllTrackingService :: parseStringParameterMatches()
//  /dist/bitrix/modules/bizproc/classes/general/trackingservice.php:141

    
public static function parseStringParameterMatches($matches$documentType null)
    {
        
$result "";
        
$documentType is_array($documentType) ? array_filter($documentType) : null;

        if (
$matches[1] == "user")
        {
            
$user $matches[2];

            
$l strlen("user_");
            if (
substr($user0$l) == "user_")
            {
                
$result CBPHelper::ConvertUserToPrintableForm(intval(substr($user$l)));
            }
            elseif (
strpos($user'group_') === 0)
            {
                
$result htmlspecialcharsbx(CBPHelper::getExtendedGroupName($user));
            }
            elseif (
$documentType)
            {
                
$v implode(","$documentType);
                if (!
array_key_exists($v,self::$userGroupsCache ))
                    
self::$userGroupsCache[$v] = CBPDocument::GetAllowableUserGroups($documentType);

                
$result self::$userGroupsCache[$v][$user];
            }
            else
                
$result $user;
        }
        elseif (
$matches[1] == "group")
        {
            if (
strpos($matches[2], 'group_') === 0)
            {
                
$result htmlspecialcharsbx(CBPHelper::getExtendedGroupName($matches[2]));
            }
            elseif (
$documentType)
            {
                
$v implode(","$documentType);
                if (!
array_key_exists($vself::$userGroupsCache))
                    
self::$userGroupsCache[$v] = CBPDocument::GetAllowableUserGroups($documentType);

                
$result self::$userGroupsCache[$v][$matches[2]];
            }
            else
                
$result $matches[2];
        }
        else
        {
            
$result $matches[0];
        }
        return 
$result;
    }