예제 #1
0
 public function testArrayEach()
 {
     $arr = ['one' => 'red', 'two' => 'blue', 'three' => 'green'];
     $context = [];
     func\array_each($arr, function ($value, $key, &$context) {
         $context[$value] = $key;
     }, $context);
     $this->assertEquals(array_flip($arr), $context);
 }
예제 #2
0
 /**
  * Loads one or more config files from the config directory
  *
  * @param string       $path
  * @param array|string $file The filename(s) without extension. If array, each file,
  *                           if string, a single file will be loaded to $config[filename]
  * @return $this
  */
 public function loadConfigFile(string $path, $file)
 {
     $this->diskDriver = new DiskDriver();
     if (is_array($file)) {
         func\array_each($file, function ($v, $k, $p) {
             $this->config[$v] = $this->diskDriver->getRequire($p . '/' . $v . '.php');
         }, $path);
     } else {
         $this->config[$file] = $this->diskDriver->getRequire($path . '/' . $file . '.php');
     }
     return $this;
 }