CustomCsvParser.php
563 Bytes
<?php
/**
 * Created by PhpStorm.
 * User: Cibermag
 * Date: 04.09.2015
 * Time: 16:07
 */
namespace backend\components\parsers;
class CustomCsvParser extends  \yii\multiparser\CsvParser {
    public $last_line = 10;
    public $hasHeaderRow = true;
    public $keys = ['first','second', 'third', 'forth', 'fifth'];
    protected function readRow()
    {
        $row = parent::readRow();
        if (is_array($row)) {
            $row = Encoder::encodeArray( Encoder::$in_charset, Encoder::$out_charset, $row );
        }
        return $row;
    }
}