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(); $this->run(); } 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 = new CsvParser( ); $csvParser->setup( $this->fileObject, $first_line, $first_column ); return $csvParser->read(); }; } }