/** * Jump to first child feature */ private function jumpToFirstChild() { $eg_node = $this->getNode(); if (isset($eg_node['!a']['class']) || sizeof($this->URL->getParamsAsArray()) || !isset($eg_node['!c']['url'])) { return; } foreach ($eg_node['!c']['url'] as $v) { PWELogger::info('Jump To First Сhild: %s', $v['!a']['link']); $jumpTo = $v['!a']['link'] . '/'; if (isset($_SERVER["QUERY_STRING"]) && strlen($_SERVER["QUERY_STRING"])) { $jumpTo .= '?' . $_SERVER["QUERY_STRING"]; } throw new HTTP3xxException($jumpTo, HTTP3xxException::REDIRECT); } }
public function testGetParamsAsArray() { $n3 = array('!a' => array('link' => '3')); $n2 = array('!a' => array('link' => '2')); $n2['!c']['url'] = array($n3); $n1 = array('!a' => array('link' => '1')); $n1['!c']['url'] = array($n2); $n0 = array('!a' => array()); $n0['!c']['url'] = array($n1); $struct = array('url' => array($n0)); $_SERVER["DOCUMENT_ROOT"] = dirname($_SERVER["SCRIPT_FILENAME"]); $obj = new PWEURL('/1/2/3/', $struct); $this->assertEquals(array('', '1', '2', '3'), $obj->getFullAsArray()); }