Blame view

vendor/yiisoft/multiparser/ParserConfigurator.php 749 Bytes
036717a1   Mihail   add error excepti...
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
  <?php
  namespace yii\multiparser;
  
  class ParserConfigurator
  {
  
      private static $configuration = [
          'csv' =>
              ['web' =>
                  ['class' => 'backend\components\parsers\CustomCsvParser',
                      'auto_detect_first_line' => true,]]];
  
  
      public static function getConfiguration($extension, $mode)
      {
          if (!isset( self::$configuration[$extension] )){
              throw new \ErrorException( "Parser do not maintain file with extension  {$extension}");
          }
          if (!isset( self::$configuration[$extension][$mode] )){
              throw new \ErrorException( "Parser configurator do not have settings for {$mode} mode");
          }
  
          return self::$configuration[$extension][$mode];
      }
  
  }