filePath = $filePath; $this->options = $options; try { $this->fileObject = new \SplFileObject( $this->filePath , 'r' );; } catch (\ErrorException $e) { Yii::warning("Ошибка открытия файла {$this->filePath}"); } //preg_match( '/\.[^\.]+$/i',$filePath, $resultArray ); $this->extension = $this->fileObject->getExtension(); } public function run(){ if ($this->extension = 'csv'){ $first_line = isset( $this->options->first_line )? $this->options->first_line : 0; $first_column = isset( $this->options->first_column )? $this->options->first_column : 0; $csvParser = Yii::createObject([ 'class' => 'backend\components\parsers\CsvParser', 'file' => $this->fileObject, 'auto_detect_start_position' => true, ]); //CustomVarDamp::dumpAndDie($csvParser); // $csvParser = new CsvParser( ); $csvParser->setup( ); // CustomVarDamp::dumpAndDie($data); return $csvParser->read();;// }; } }