CBPRestActivity :: CalculateTimeoutDuration: Bitrix method

      
<?php 
//  CBPRestActivity :: CalculateTimeoutDuration()
//  /dist/bitrix/modules/bizproc/classes/general/restactivity.php:678

    
private function CalculateTimeoutDuration()
    {
        
$timeoutDuration = ($this->IsPropertyExists('TimeoutDuration') ? $this->TimeoutDuration 0);

        
$timeoutDurationType = ($this->IsPropertyExists('TimeoutDurationType') ? $this->TimeoutDurationType "s");
        
$timeoutDurationType strtolower($timeoutDurationType);
        if (!
in_array($timeoutDurationType, array('s''d''h''m')))
            
$timeoutDurationType 's';

        
$timeoutDuration intval($timeoutDuration);
        switch (
$timeoutDurationType)
        {
            case 
'd':
                
$timeoutDuration *= 3600 24;
                break;
            case 
'h':
                
$timeoutDuration *= 3600;
                break;
            case 
'm':
                
$timeoutDuration *= 60;
                break;
            default:
                break;
        }

        return 
min($timeoutDuration3600 24 365 5);
    }