CBPWorkflowTemplateLoader::ExtractValuesFromVariables: Bitrix method

      
<?php 
//  CBPWorkflowTemplateLoader :: ExtractValuesFromVariables()
//  /dist/bitrix/modules/bizproc/classes/general/workflowtemplateloader.php:499

    
private static function ExtractValuesFromVariables($ar$variables$constants = array())
    {
        if (
is_string($ar) && preg_match(CBPActivity::ValuePattern$ar$arMatches))
            
$ar = array($arMatches['object'], $arMatches['field']);

        if (
is_array($ar))
        {
            if (!
CBPHelper::IsAssociativeArray($ar))
            {
                if (
count($ar) == && ($ar[0] == 'Variable' || $ar[0] == 'Constant' || $ar[0] == 'Template'))
                {
                    if (
$ar[0] == 'Variable' && is_array($variables) && array_key_exists($ar[1], $variables))
                        return array(
$variables[$ar[1]]["Default"]);
                    if (
$ar[0] == 'Constant' && is_array($constants) && array_key_exists($ar[1], $constants))
                        return array(
$constants[$ar[1]]["Default"]);

                    return array();
                }

                
$arResult = array();
                foreach (
$ar as $ar1)
                    
$arResult[] = self::ExtractValuesFromVariables($ar1$variables$constants);

                return 
$arResult;
            }
        }

        return 
$ar;
    }