YiiMultiparser.php
1.21 KB
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
44
45
46
47
48
49
50
51
52
<?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();
}
public function init()
{
if( isset($this->configuration['glob']) && isset($this->configuration['glob']['ini'])){
foreach ($this->configuration['glob']['ini'] as $ini_setting => $ini_setting_value) {
ini_set( $ini_setting, $ini_setting_value );
}
}
}
}