fossasia/engelsystem

View on GitHub
includes/controller/user_messages_controller.php

Summary

Maintainability
F
3 days
Test Coverage

Showing 11 of 11 total issues

Function user_messages has a Cognitive Complexity of 63 (exceeds 5 allowed). Consider refactoring.
Open

function user_messages() {
global $user;
 
if (! isset($_REQUEST['action'])) {
$users = user_by_nick($user['UID']);
Severity: Minor
Found in includes/controller/user_messages_controller.php - About 1 day to fix

Method user_messages has 130 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function user_messages() {
global $user;
 
if (! isset($_REQUEST['action'])) {
$users = user_by_nick($user['UID']);
Severity: Major
Found in includes/controller/user_messages_controller.php - About 5 hrs to fix

    Avoid too many return statements within this method.
    Open

    return error(_("Transmitting was terminated with an Error."), true);
    Severity: Major
    Found in includes/controller/user_messages_controller.php - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

      return error(_("No Message found."), true);
      Severity: Major
      Found in includes/controller/user_messages_controller.php - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

        return error(_("Transmitting was terminated with an Error."), true);
        Severity: Major
        Found in includes/controller/user_messages_controller.php - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

          return error(_("Transmitting was terminated with an Error."), true);
          Severity: Major
          Found in includes/controller/user_messages_controller.php - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

            return error(_("Wrong action."), true);
            Severity: Major
            Found in includes/controller/user_messages_controller.php - About 30 mins to fix

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

              case "delete":
              if (isset($_REQUEST['id']) && preg_match("/^[0-9]{1,11}$/", $_REQUEST['id']))
              $id = $_REQUEST['id'];
              else
              return error(_("Incomplete call, missing Message ID."), true);
              Severity: Major
              Found in includes/controller/user_messages_controller.php and 1 other location - About 4 hrs to fix
              includes/controller/user_messages_controller.php on lines 96..108

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

              case "read":
              if (isset($_REQUEST['id']) && preg_match("/^[0-9]{1,11}$/", $_REQUEST['id']))
              $id = $_REQUEST['id'];
              else
              return error(_("Incomplete call, missing Message ID."), true);
              Severity: Major
              Found in includes/controller/user_messages_controller.php and 1 other location - About 4 hrs to fix
              includes/controller/user_messages_controller.php on lines 110..122

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

              if (count($users_source) == 0) {
              success(_("There are no members in the selected Angeltype"));
              redirect(page_link_to("user_messages"));
              } elseif (count($users_source) == $temp) {
              redirect(page_link_to("user_messages"));
              Severity: Major
              Found in includes/controller/user_messages_controller.php and 1 other location - About 1 hr to fix
              includes/controller/user_messages_controller.php on lines 135..142

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

              if (count($group_users) == 0) {
              success(_("There are no members in the selected group"));
              redirect(page_link_to("user_messages"));
              } elseif (count($group_users) == $temp) {
              redirect(page_link_to("user_messages"));
              Severity: Major
              Found in includes/controller/user_messages_controller.php and 1 other location - About 1 hr to fix
              includes/controller/user_messages_controller.php on lines 152..159
              Category
              Status