lib/models/DataInterface.php
public function estimateDuration()
    {
        $durations = [];
        $logs = DataInterfaceLog::find()->where(['data_interface_id' => $this->primaryKey, 'status' => 'success'])->all();
        foreach ($logs as $log) {
            if (empty($log->ended) || empty($log->started)) {
                continue;
            }
            $durations[] = strtotime($log->ended) - strtotime($log->started);
        }
        if (empty($durations)) {
            return false;
        }
        $average = array_sum($durations) / count($durations);
        $max = max($durations);

        return $average;

        return ($average + $max) / 2;
    }
public function estimateDuration()
    {
        $durations = [];
        $logs = DataInterfaceLog::find()->where(['data_interface_id' => $this->primaryKey, 'status' => 'success'])->all();
        foreach ($logs as $log) {
            if (empty($log->ended) || empty($log->started)) {
                continue;
            }
            $durations[] = strtotime($log->ended) - strtotime($log->started);
        }
        if (empty($durations)) {
            return false;
        }
        $average = array_sum($durations) / count($durations);
        $max = max($durations);

        return $average;

        return ($average + $max) / 2;
    }
public function estimateDuration ( ) { $ durations = [ ] ; $ logs = DataInterfaceLog :: find ( ) -> where ( [ 'data_interface_id' => $ this -> primaryKey , 'status' => 'success' ] ) -> all ( ) ; foreach ( $ logs as $ log ) { if ( empty ( $ log -> ended ) || empty ( $ log -> started ) ) { continue ; } $ durations [ ] = strtotime ( $ log -> ended ) - strtotime ( $ log -> started ) ; } if ( empty ( $ durations ) ) { return false ; } $ average = array_sum ( $ durations ) / count ( $ durations ) ; $ max = max ( $ durations ) ; return $ average ; return ( $ average + $ max ) / 2 ; }
[[@doctodo method_description:estimateDuration]].

@return [[@doctodo return_type:estimateDuration]] [[@doctodo return_description:estimateDuration]]
[[ @doctodo method_description : estimateDuration ]] .