setupConverter(); } protected function setupConverter() { if ( $this->has_header_row || $this->keys !== NULL ) { // если у файла есть заголовок, то в результате имеем ассоциативный массив $this->converter_conf['hasKey'] = 1; } if ( $this->converter_conf ) { $converter = ObjectCreator::build( $this->converter_conf ); if ( $converter instanceof ConverterInterface ) { $this->converter = $converter; } } } public abstract function read(); /** * @param $arr * @return mixed * преобразовует значения прочитанного массива в нужные типы, согласно конфигурации конвертера */ protected function convert( $arr ) { if ($this->converter !== NULL) { $arr = $this->converter->convertByConfiguration( $arr, $this->converter_conf ); } return $arr; } public final static function supportedExtension() { return ['csv','xml','xlsx','txt','xls']; } protected function cleanUp( ) { unset( $this->file ); unset( $this->converter ); unset( $this->converter_conf ); } }