function testArrayMergeMany() { $a = array('orange', 'nested' => array(1), 'b' => 1); $b = array('apple', 'nested' => array(2), 'a' => 1); $c = array('banana', 'b' => 2); $this->assertEqual(lmbArrayHelper::arrayMerge($a, $b, $c), array('banana', 'nested' => array(2), 'b' => 2, 'a' => 1)); }
protected function _initRequestProperties($uri_string, $get, $post, $cookies, $files) { $this->__uri = !is_null($uri_string) ? new lmbUri($uri_string) : new lmbUri($this->getRawUriString()); $this->__get = !is_null($get) ? $get : $_GET; $items = $this->__uri->getQueryItems(); foreach ($items as $k => $v) { $this->__get[$k] = $v; } $this->__post = !is_null($post) ? $post : $_POST; $this->__cookies = !is_null($cookies) ? $cookies : $_COOKIE; $this->__files = !is_null($files) ? $this->_parseUploadedFiles($files) : $this->_parseUploadedFiles($_FILES); $this->_defineRequestMethod(); if ($this->getRequestMethod() == 'PUT') { $this->__put = lmbToolkit::instance()->getInputStreamParser()->parse(); } if (ini_get('magic_quotes_gpc')) { $this->__get = $this->_stripHttpSlashes($this->__get); $this->__post = $this->_stripHttpSlashes($this->__post); $this->__put = $this->_stripHttpSlashes($this->__put); $this->__cookies = $this->_stripHttpSlashes($this->__cookies); } $this->__request = lmbArrayHelper::arrayMerge($this->__get, $this->__post, $this->__put, $this->__files); foreach ($this->__request as $k => $v) { if (in_array($k, $this->__reserved_attrs)) { continue; } $this->set($k, $v); } }