Commit 375f05f2 authored by Zohten's avatar Zohten

more changes before refactoring

parent 4314b03a
......@@ -19,17 +19,19 @@ class UserController extends Controller
*/
public function processRequest()
{
switch ($this->request->getHttpMethod()) {
$httpMethod=$this->request->getHttpMethod();
$uriParams=$this->request->getUriParams();
switch($httpMethod) {
case 'GET':
if ($this->request->getUriParams()) {
return $this->getUser($this->request->getUriParams()[0]);
if ($uriParams) {
return $this->getUser($uriParams[0]);
}
return $this->getAllUsers();
break;
case 'PUT':
if ($this->request->getUriParams()) {
return $this->updateUser(array_merge($this->request->getData(), ['id'=>$this->request->getUriParams()[0]]));
if ($uriParams) {
return $this->updateUser(array_merge($this->request->getData(), ['id'=>$uriParams[0]]));
}
break;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment