public function update($configs) { if (isset($configs['components'])) { $configs['components'] = array_map(function ($value) { return ['class' => '\\' == $value[0][0] ? $value[0] : '\\zf\\components\\' . $value[0], 'constructArgs' => isset($value[1]) ? $value[1] : []]; }, Data::pushLeft($configs['components'])); } if ($this->_configs) { foreach ($configs as $key => $value) { if (is_array($value) && isset($this->_configs[$key])) { $this->_configs[$key] = $value + $this->_configs[$key]; } else { $this->_configs[$key] = $value; } } } else { $this->_configs = $configs; } }
public function testPushLeft() { $input = ['key' => 1, 2, 'key2' => 3, 'key3' => 4, 5]; $this->assertSame(Data::pushLeft($input), ['key' => [1, 2], 'key2' => [3], 'key3' => [4, 5]]); }