CBPWorkflowTemplateLoader :: ValidateTemplate: Bitrix method

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

    
private function ValidateTemplate($arActivity$user)
    {
        
$errors CBPActivity::CallStaticMethod(
            
$arActivity["Type"],
            
"ValidateProperties",
            array(
$arActivity["Properties"], $user)
        );

        
$pref '';
        if (isset(
$arActivity["Properties"]) && isset($arActivity["Properties"]["Title"]))
        {
            
$pref str_replace("#TITLE#"$arActivity["Properties"]["Title"], GetMessage("BPWTL_ERROR_MESSAGE_PREFIX"))." ";
        }

        foreach (
$errors as $i => $e)
        {
            
$errors[$i]["message"] = $pref.$e["message"];
            
$errors[$i]["activityName"] = $arActivity['Name'];
        }

        if (
array_key_exists("Children"$arActivity) && count($arActivity["Children"]) > 0)
        {
            
$bFirst true;
            foreach (
$arActivity["Children"] as $arChildActivity)
            {
                
$childErrors CBPActivity::CallStaticMethod(
                    
$arActivity["Type"],
                    
"ValidateChild",
                    array(
$arChildActivity["Type"], $bFirst)
                );
                foreach (
$childErrors as $i => $e)
                {
                    
$childErrors[$i]["message"] = $pref.$e["message"];
                    
$childErrors[$i]["activityName"] = $arActivity['Name'];
                }
                
$errors array_merge($errors$childErrors);

                
$bFirst false;
                
$errors array_merge($errors$this->ValidateTemplate($arChildActivity$user));
            }
        }

        return 
$errors;
    }