_controller = new $control(); } //Method추출 if (isset($arguments[1])) { $route = ""; switch ($arguments[1]) { case 'service': $route = "newservices"; break; case 'history': $route = "newhistorys"; break; default: $route = $arguments[1]; break; } $this->_method = $route; } //세그먼트 추출 $segments = []; if (count($arguments) > 2) { $isKey = true; $key = ""; foreach (array_slice($arguments, 2) as $argument) { if ($isKey) { $segments[$argument] = null; $key = $argument; $isKey = false; //Value값을 넣어야하므로 } else { $segments[$key] = $argument; $isKey = true; //Key로 설정해야하므로 } } } $this->_controller->setSegments($segments); } // final public function getController(): Controller { if ($this->_controller === null) { throw new \Exception("Method 사용법 : 'http://test.com/Control/Method/arg1/arg2' 혹은 php index.php Control/Method/arg1/arg2"); } return $this->_controller; } final public function getMethod(): string { if ($this->_method === null) { throw new \Exception("Method 사용법 : 'http://test.com/Control/Method/arg1/arg2' 혹은 php index.php Control/Method/arg1/arg2"); } return $this->_method; } } //Class