Blame view

vendor/yiisoft/multiparser/ObjectCreator.php 655 Bytes
6215a30d   Mihail   add converter int...
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
  <?php
  /**
   * Created by PhpStorm.
   * User: Tsurkanov
   * Date: 20.10.2015
   * Time: 16:24
   */
  
  namespace yii\multiparser;
  
  
  use common\components\CustomVarDamp;
  
  class ObjectCreator {
      public static function build( array $configuration ){
          if ( isset( $configuration['class'] ) ) {
              $class =  $configuration['class'];
              unset( $configuration['class'] );
          } else{
              throw new \ErrorException('Error configuration - undefined class');
          }
  
          $object = new $class();
          foreach ($configuration as $name => $value) {
              $object->$name = $value;
          }
  
          return $object;
      }
  }