CBPAllHistoryService :: ParseFields: Bitrix method

      
<?php 
//  CBPAllHistoryService :: ParseFields()
//  /dist/bitrix/modules/bizproc/classes/general/historyservice.php:16

    
protected function ParseFields(&$arFields$id 0)
    {
        global 
$DB;

        
$id intval($id);
        
$updateMode = ($id true false);
        
$addMode = !$updateMode;

        if (
$addMode && !is_set($arFields"DOCUMENT_ID"))
            throw new 
CBPArgumentNullException("DOCUMENT_ID");

        if (
is_set($arFields"DOCUMENT_ID") || $addMode)
        {
            
$arDocumentId CBPHelper::ParseDocumentId($arFields["DOCUMENT_ID"]);
            
$arFields["MODULE_ID"] = $arDocumentId[0];
            if (
strlen($arFields["MODULE_ID"]) <= 0)
                
$arFields["MODULE_ID"] = false;
            
$arFields["ENTITY"] = $arDocumentId[1];
            
$arFields["DOCUMENT_ID"] = $arDocumentId[2];
        }

        if (
is_set($arFields"NAME") || $addMode)
        {
            
$arFields["NAME"] = (string) $arFields["NAME"];
            if (
strlen($arFields["NAME"]) <= 0)
                throw new 
CBPArgumentNullException("NAME");
        }

        if (
is_set($arFields"DOCUMENT"))
        {
            if (
$arFields["DOCUMENT"] == null)
            {
                
$arFields["DOCUMENT"] = false;
            }
            elseif (
is_array($arFields["DOCUMENT"]))
            {
                if (
count($arFields["DOCUMENT"]) > 0)
                    
$arFields["DOCUMENT"] = $this->GetSerializedForm($arFields["DOCUMENT"]);
                else
                    
$arFields["DOCUMENT"] = false;
            }
            else
            {
                throw new 
CBPArgumentTypeException("DOCUMENT");
            }
        }

        unset(
$arFields["MODIFIED"]);
    }