Skip to content

Commit

Permalink
Merge pull request #3 from yanisayad/feature/118382
Browse files Browse the repository at this point in the history
[FEATURE#118382] Demande de suppression change_request
  • Loading branch information
Guillaume DUBOST authored Jan 2, 2019
2 parents a8d75d3 + 1f35a2c commit 4fb3bc4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
17 changes: 8 additions & 9 deletions src/ChangeRequestManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,7 @@ public function validate(ChangeTodos $change_request)
"response_comment" => $change_request->getResponseComment()
];

$response = $this->fireRequest("PUT", "/change_todos/{$change_request->getId()}/status", $body);

return $response;
return $this->fireRequest("PUT", "/change_todos/{$change_request->getId()}/status", $body);
}

public function invalidate(ChangeTodos $change_request)
Expand All @@ -74,25 +72,26 @@ public function invalidate(ChangeTodos $change_request)
"response_comment" => $change_request->getResponseComment()
];

$response = $this->fireRequest("PUT", "/change_todos/{$change_request->getId()}/status", $body);
return $this->fireRequest("PUT", "/change_todos/{$change_request->getId()}/status", $body);
}

return $response;
public function cancel(ChangeTodos $change_todos)
{
return $this->fireRequest("PUT", "/change_todos/{$change_todos->getId()}/cancel", []);
}

public function save(ChangeTodos $change_todos)
{
$body = $change_todos->toArray();

$response = $this->fireRequest("POST", "/change_todos", $body);

return $response;
return $this->fireRequest("POST", "/change_todos", $body);
}

private function fireRequest($method, $uri, $body = [])
{
$method = strtoupper($method);

if (false === in_array($method, ["GET", "POST", "PUT", "DELETE", "OPTIONS"])) {
if (!in_array($method, ["GET", "POST", "PUT", "DELETE", "OPTIONS"])) {
return $this->app->abort(405, "ChangeRequestProxy can not fire request of method : {$method}");
}

Expand Down
2 changes: 1 addition & 1 deletion src/ChangeTodos.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ public function getDatas()
* Gets the value of request type.
*
* @return string
*/
*/
public function getRequestType()
{
return $this->request_type;
Expand Down

0 comments on commit 4fb3bc4

Please sign in to comment.