ConditionGroup::convertBizprocActivity: Bitrix method

      
<?php 
//  Bitrix\Bizproc\Automation\Engine\ConditionGroup :: convertBizprocActivity()
//  /dist/bitrix/modules/bizproc/lib/automation/engine/conditiongroup.php:247

    
public static function convertBizprocActivity(array &$activity, array $documentType)
    {
        
$conditionGroup false;
        
$documentService = \CBPRuntime::GetRuntime(true)->getDocumentService();
        
$documentFields $documentService->GetDocumentFields($documentType);

        if (
            
count($activity['Children']) === 2
            
&& $activity['Children'][0]['Type'] === 'IfElseBranchActivity'
            
&& $activity['Children'][1]['Type'] === 'IfElseBranchActivity'
            
&& !empty($activity['Children'][0]['Properties']['fieldcondition'])
            && !empty(
$activity['Children'][1]['Properties']['truecondition'])
            && 
count($activity['Children'][0]['Children']) === 1
            
&& count($activity['Children'][0]['Properties']['fieldcondition']) > 0
        
)
        {
            
$conditionGroup = new static();
            
$bizprocConditions $activity['Children'][0]['Properties']['fieldcondition'];

            foreach (
$bizprocConditions as $index => $fieldCondition)
            {
                
$property = isset($documentFields[$fieldCondition[0]]) ? $documentFields[$fieldCondition[0]] : null;
                if (
$property && $property['Type'] === 'user')
                {
                    
$fieldCondition[2] = \CBPHelper::UsersArrayToString(
                        
$fieldCondition[2],
                        
null,
                        
$documentType
                    
);
                }

                
$conditionItem = new Condition(array(
                    
'field' => $fieldCondition[0],
                    
'operator' => $fieldCondition[1],
                    
'value' => self::convertExpressions($fieldCondition[2], $documentType),
                ));

                
$nextCondition = isset($bizprocConditions[$index 1]) ? $bizprocConditions[$index 1] : null;
                
$joiner = ($nextCondition && !empty($nextCondition[3])) ? static::JOINER_OR : static::JOINER_AND;

                
$conditionGroup->addItem($conditionItem$joiner);
            }

            
$activity $activity['Children'][0]['Children'][0];
        }

        return 
$conditionGroup;
    }