Craft\Import_HistoryService::showLog PHP Method

showLog() public method

Show a specific log item.
public showLog ( integer $history ) : array
$history integer
return array
    public function showLog($history)
    {
        // Set criteria
        $criteria = new \CDbCriteria();
        $criteria->condition = 'historyId = :history_id';
        $criteria->params = array(':history_id' => $history);
        // Get errors
        $errors = array();
        $logs = $this->findAllLogs($criteria);
        foreach ($logs as $log) {
            $errors[$log['line']] = $log['errors'];
        }
        // Get total rows
        $model = $this->findHistoryById($history);
        $total = array();
        if ($model) {
            $rows = $model->rows;
            // Make "total" list
            for ($i = 2; $i <= $rows + 1; ++$i) {
                $total[$i] = isset($errors[$i]) ? $errors[$i] : array(Craft::t('None'));
            }
        }
        return $total;
    }