Skip to content

Commit

Permalink
Merge branch 'feature/add-comment' of github.com:CPNV-ES/MAW11_Looper…
Browse files Browse the repository at this point in the history
…_GEJ into feature/add-comment
  • Loading branch information
EthannSchneider committed Dec 4, 2024
2 parents 64b2d5e + 379c00e commit 0e52859
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 22 deletions.
32 changes: 16 additions & 16 deletions src/controllers/error.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
/**
* @author Ethann Schneider, Guillaume Aubert, Jomana Kaempf
* @version 29.11.2024
* @description This file have function to show an error page when the user is not allowed to access
* @description This file contains functions to handle various error responses such as 404 Not Found
*/

/**
* send a 404 error code with a page not found
* Send a 404 Not Found error page.
*
* @param int $return_code
* @param string $error_message
* @param int $return_code The HTTP response code to send. Default is 404.
* @param string $error_message The error message to display. Default is 'Page not found'.
* @return void
*/
function lost($return_code = 404, $error_message = 'Page not found')
Expand All @@ -19,10 +19,10 @@ function lost($return_code = 404, $error_message = 'Page not found')
}

/**
* send a generic error specify the return code and error message
* Send a generic error with a specified return code and message.
*
* @param int $return_code
* @param string $error_message
* @param int $return_code The HTTP response code to send.
* @param string $error_message The error message to display.
* @return void
*/
function error($return_code, $error_message)
Expand All @@ -31,10 +31,10 @@ function error($return_code, $error_message)
}

/**
* send a 400 error code with a Bad Request
* Send a 400 Bad Request error page.
*
* @param int $return_code
* @param string $error_message
* @param int $return_code The HTTP response code to send. Default is 400.
* @param string $error_message The error message to display. Default is 'Bad Request'.
* @return void
*/
function badRequest($return_code = 400, $error_message = 'Bad Request')
Expand All @@ -43,10 +43,10 @@ function badRequest($return_code = 400, $error_message = 'Bad Request')
}

/**
* send a 401 error code with an Unauthorized
* Send a 401 Unauthorized error page.
*
* @param int $return_code
* @param string $error_message
* @param int $return_code The HTTP response code to send. Default is 401.
* @param string $error_message The error message to display. Default is 'Unauthorized'.
* @return void
*/
function unauthorized($return_code = 401, $error_message = 'Unauthorized')
Expand All @@ -55,10 +55,10 @@ function unauthorized($return_code = 401, $error_message = 'Unauthorized')
}

/**
* send a 500 error code with a Server Error
* Send a 500 Internal Server Error page.
*
* @param int $return_code
* @param string $error_message
* @param int $return_code The HTTP response code to send. Default is 500.
* @param string $error_message The error message to display. Default is 'Server Error'.
* @return void
*/
function serverError($return_code = 500, $error_message = 'Server Error')
Expand Down
15 changes: 9 additions & 6 deletions src/controllers/exercise_controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,14 @@
include_once MODEL_DIR . '/exercise.php';

/**
* ExerciseController
* Class ExerciseController
*
* Manages the backend operations for exercises, including creation, deletion, and state transitions.
*/
class ExerciseController
{
/**
* create an exercise
* This method creates a new exercise based on the title provided by the user via `$_POST['exercise_title']`.
*
* @return void
*/
Expand All @@ -30,9 +32,10 @@ public function createExercise()
}

/**
* Delete an exercise
* This method deletes an exercise identified by `$id`. It only allows deletion if the exercise
* is in the `Building` or `Closed` state.
*
* @param int $id
* @param int $id The ID of the exercise to be deleted.
* @return void
*/
public function deleteExercise(int $id)
Expand All @@ -46,9 +49,9 @@ public function deleteExercise(int $id)
}

/**
* Change state of an exercise
* This method changes the state of an exercise identified by `$id`.
*
* @param int $id
* @param int $id The ID of the exercise whose state is to be changed.
* @return void
*/
public function changeStateOfExercise(int $id)
Expand Down

0 comments on commit 0e52859

Please sign in to comment.