Commit d10eb1533fc950165c79150c403ad27f31d18b1a
1 parent
036717a1
add multiparser yii component
Showing
4 changed files
with
44 additions
and
2 deletions
Show diff stats
backend/config/main.php
backend/models/UploadFileParsingForm.php
| ... | ... | @@ -52,8 +52,7 @@ class UploadFileParsingForm extends Model |
| 52 | 52 | |
| 53 | 53 | public function readFile($filePath){ |
| 54 | 54 | |
| 55 | - $parser = new ParserHandler( $filePath ); | |
| 56 | - $data = $parser->run(); | |
| 55 | + $data = Yii::$app->multiparser->parse($filePath); | |
| 57 | 56 | |
| 58 | 57 | if( !is_array($data) ){ |
| 59 | 58 | $data = ['No results']; | ... | ... |
| 1 | +<?php | |
| 2 | +/** | |
| 3 | + * Created by PhpStorm. | |
| 4 | + * User: Cibermag | |
| 5 | + * Date: 07.09.2015 | |
| 6 | + * Time: 15:56 | |
| 7 | + */ | |
| 8 | + | |
| 9 | +namespace yii\multiparser; | |
| 10 | + | |
| 11 | +use yii\base\Component; | |
| 12 | + | |
| 13 | + | |
| 14 | +class YiiMultiparser extends Component{ | |
| 15 | + | |
| 16 | + public function parse( $filePath, $options = [] ){ | |
| 17 | + | |
| 18 | + $parser = new YiiParserHandler( $filePath, $options ); | |
| 19 | + return $parser->run(); | |
| 20 | + | |
| 21 | + } | |
| 22 | + | |
| 23 | +} | |
| 0 | 24 | \ No newline at end of file | ... | ... |