Exemple #1
0
 /**
  * Loads a supported configuration file format.
  *
  * @param  string|array $path
  *
  * @throws EmptyDirectoryException    If `$path` is an empty directory
  */
 public function __construct($path)
 {
     $paths = $this->getValidPath($path);
     $this->data = array();
     foreach ($paths as $path) {
         // Get file information
         $info = pathinfo($path);
         $extension = isset($info['extension']) ? $info['extension'] : '';
         $parser = $this->getParser($extension);
         // Try and load file
         $this->data = array_replace_recursive($this->data, (array) $parser->parse($path));
     }
     parent::__construct($this->data);
 }
 /**
  * Loads a supported configuration file format.
  *
  * @param  string|array $path
  *
  * @throws EmptyDirectoryException    If `$path` is an empty directory
  */
 public function __construct($path)
 {
     $paths = $this->getValidPath($path);
     $this->data = array();
     foreach ($paths as $path) {
         // Get file information
         $info = pathinfo($path);
         $parts = explode('.', $info['basename']);
         $extension = array_pop($parts);
         if ($extension === 'dist') {
             $extension = array_pop($parts);
         }
         $parser = $this->getParser($extension);
         // Try and load file
         $this->data = array_replace_recursive($this->data, (array) $parser->parse($path));
     }
     parent::__construct($this->data);
 }
Exemple #3
0
 public function __construct()
 {
     parent::__construct([]);
 }
Exemple #4
0
 /**
  * Constructor method and sets default options, if any
  *
  * @param array $data
  */
 public function __construct(array $data)
 {
     $filteredData = array_filter(array_merge($this->getDefaults(), $data));
     parent::__construct($filteredData);
 }