Blame view

vendor/yiisoft/multiparser/ParserConfigurator.php 764 Bytes
036717a1   Mihail   add error excepti...
1
2
3
4
5
6
  <?php
  namespace yii\multiparser;
  
  class ParserConfigurator
  {
  
3c5edb9b   Mihail   edit createAssocA...
7
      protected static  $configuration;
036717a1   Mihail   add error excepti...
8
  
3c5edb9b   Mihail   edit createAssocA...
9
      public static function getConfiguration($extension, $parameter)
036717a1   Mihail   add error excepti...
10
      {
3c5edb9b   Mihail   edit createAssocA...
11
12
          self::setConfiguration();
  
036717a1   Mihail   add error excepti...
13
14
15
          if (!isset( self::$configuration[$extension] )){
              throw new \ErrorException( "Parser do not maintain file with extension  {$extension}");
          }
3c5edb9b   Mihail   edit createAssocA...
16
17
          if (!isset( self::$configuration[$extension][$parameter] )){
              throw new \ErrorException( "Parser configurator do not have settings for {$parameter} parameter");
036717a1   Mihail   add error excepti...
18
19
          }
  
3c5edb9b   Mihail   edit createAssocA...
20
          return self::$configuration[$extension][$parameter];
036717a1   Mihail   add error excepti...
21
22
      }
  
3c5edb9b   Mihail   edit createAssocA...
23
24
25
26
27
28
29
30
31
   protected static function setConfiguration()
      {
  
         self::$configuration = require(__DIR__ . '/config.php');
  
      }
  
  
  
036717a1   Mihail   add error excepti...
32
  }