CBPAllStateService::__ExtractState: Bitrix method

      
<?php 
//  CBPAllStateService :: __ExtractState()
//  /dist/bitrix/modules/bizproc/classes/general/stateservice.php:174

    
private static function __ExtractState(&$arStates$arResult)
    {
        if (!
array_key_exists($arResult["ID"], $arStates))
        {
            
$arStates[$arResult["ID"]] = array(
                
"ID" => $arResult["ID"],
                
"TEMPLATE_ID" => $arResult["WORKFLOW_TEMPLATE_ID"],
                
"TEMPLATE_NAME" => $arResult["NAME"],
                
"TEMPLATE_DESCRIPTION" => $arResult["DESCRIPTION"],
                
"STATE_MODIFIED" => $arResult["MODIFIED"],
                
"STATE_NAME" => $arResult["STATE"],
                
"STATE_TITLE" => $arResult["STATE_TITLE"],
                
"STATE_PARAMETERS" => (strlen($arResult["STATE_PARAMETERS"]) > unserialize($arResult["STATE_PARAMETERS"]) : array()),
                
"WORKFLOW_STATUS" => $arResult["STATUS"],
                
"STATE_PERMISSIONS" => array(),
                
"DOCUMENT_ID" => array($arResult["MODULE_ID"], $arResult["ENTITY"], $arResult["DOCUMENT_ID"]),
                
"STARTED" => $arResult["STARTED"],
                
"STARTED_BY" => $arResult["STARTED_BY"],
                
"STARTED_FORMATTED" => $arResult["STARTED_FORMATTED"],
            );
        }

        if (
strlen($arResult["PERMISSION"]) > && strlen($arResult["OBJECT_ID"]) > 0)
        {
            
$arResult["PERMISSION"] = strtolower($arResult["PERMISSION"]);

            if (!
array_key_exists($arResult["PERMISSION"], $arStates[$arResult["ID"]]["STATE_PERMISSIONS"]))
                
$arStates[$arResult["ID"]]["STATE_PERMISSIONS"][$arResult["PERMISSION"]] = array();

            
$arStates[$arResult["ID"]]["STATE_PERMISSIONS"][$arResult["PERMISSION"]][] = $arResult["OBJECT_ID"];
        }
    }