YiiMultiparser.php
921 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?php
/**
 * Created by PhpStorm.
 * User: Cibermag
 * Date: 07.09.2015
 * Time: 15:56
 */
namespace yii\multiparser;
use common\components\CustomVarDamp;
use yii\base\Component;
class YiiMultiparser extends Component{
public $configuration;
    public function getConfiguration($extension, $conf_parameter){
        if (!isset( $this->configuration[$extension] )){
            throw new \ErrorException( "Parser do not maintain file with extension  {$extension}");
        }
        if (!isset( $this->configuration[$extension][$conf_parameter] )){
            throw new \ErrorException( "Parser configurator do not have settings for {$conf_parameter} parameter");
        }
        return $this->configuration[$extension][$conf_parameter];
    }
    public function parse( $filePath, $options = [] ){
        $parser = new YiiParserHandler( $filePath, $options );
        return $parser->run();
    }
}