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