/**
  * This function checks if a parameter contained in a request has a valid value
  * @param  Slim   $app   [Slim instance]
  * @param  $param        [the parameter to check]
  * @return string
  */
 public static function checkParamValue(Slim $app, $param, $value)
 {
     $app->response->headers->set('Content-Type', 'application/json');
     if (is_null($value) || empty($value)) {
         OutputFormatter::formatOutput($app, 400, "Missing or invalid parameter value for: {$param}");
     } else {
         return $value;
     }
 }
 /**
  * This method is used to delete an emoji from the database
  * @param  Slim   $app      [Slim instance]
  * @param  $id              [the id of the emoji in the emojis table]
  * @return json encoded string
  */
 public static function deleteEmoji(Slim $app, $id)
 {
     $app->response->headers->set('Content-Type', 'application/json');
     Authenticator::authenticate($app);
     $rows = Emoji::destroyById($id);
     if (is_string($rows)) {
         OutputFormatter::formatOutput($app, 404, $rows);
     }
     if ($rows > 0) {
         OutputFormatter::formatOutput($app, 200, "Emoji with ID {$id} deleted successfully.");
     } else {
         OutputFormatter::formatOutput($app, 400, "Failed to delete Emoji with ID {$id}.");
     }
 }
 /**
  * A simple logout function
  * @param  Slim   $app
  */
 public static function logout(Slim $app)
 {
     Authenticator::authenticate($app);
     OutputFormatter::formatOutput($app, 200, "You've logged out successfully.");
 }