fossasia/engelsystem

View on GitHub
includes/view/User_view.php

Summary

Maintainability
D
2 days
Test Coverage

Showing 13 of 13 total issues

Method User_view has 118 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function User_view($user_source, $admin_user_privilege, $freeloader, $user_angeltypes, $user_groups, $shifts, $its_me) {
global $LETZTES_AUSTRAGEN, $privileges;
$user_name = htmlspecialchars($user_source['Vorname']) . " " . htmlspecialchars($user_source['Name']);
$myshifts_table = array();
$timesum = 0;
Severity: Major
Found in includes/view/User_view.php - About 4 hrs to fix

    Function User_view has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
    Open

    function User_view($user_source, $admin_user_privilege, $freeloader, $user_angeltypes, $user_groups, $shifts, $its_me) {
    global $LETZTES_AUSTRAGEN, $privileges;
    $user_name = htmlspecialchars($user_source['Vorname']) . " " . htmlspecialchars($user_source['Name']);
    $myshifts_table = array();
    $timesum = 0;
    Severity: Minor
    Found in includes/view/User_view.php - About 4 hrs to fix

    File User_view.php has 333 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
     
    /**
    * Available T-Shirt sizes
    */
    Severity: Minor
    Found in includes/view/User_view.php - About 4 hrs to fix

      Method Users_view has 73 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function Users_view($users, $order_by, $arrived_count, $active_count, $force_active_count, $freeloads_count, $tshirts_count, $voucher_count) {
      $search = "";
      $users_matched = [];
      if (isset($_REQUEST['search']))
      $search = strip_request_item('search');
      Severity: Major
      Found in includes/view/User_view.php - About 2 hrs to fix

        Function Users_view has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
        Open

        function Users_view($users, $order_by, $arrived_count, $active_count, $force_active_count, $freeloads_count, $tshirts_count, $voucher_count) {
        $search = "";
        $users_matched = [];
        if (isset($_REQUEST['search']))
        $search = strip_request_item('search');
        Severity: Minor
        Found in includes/view/User_view.php - About 2 hrs to fix

        Method Users_view has 8 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        function Users_view($users, $order_by, $arrived_count, $active_count, $force_active_count, $freeloads_count, $tshirts_count, $voucher_count) {
        Severity: Major
        Found in includes/view/User_view.php - About 1 hr to fix

          Method User_view has 7 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          function User_view($user_source, $admin_user_privilege, $freeloader, $user_angeltypes, $user_groups, $shifts, $its_me) {
          Severity: Major
          Found in includes/view/User_view.php - About 50 mins to fix

            Function User_shift_state_render has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

            function User_shift_state_render($user) {
            $upcoming_shifts = ShiftEntries_upcoming_for_user($user);
            if ($upcoming_shifts === false)
            return false;
             
             
            Severity: Minor
            Found in includes/view/User_view.php - About 45 mins to fix

            Function User_angeltypes_render has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

            function User_angeltypes_render($user_angeltypes) {
            $output = array();
            foreach ($user_angeltypes as $angeltype) {
            $class = "";
            if ($angeltype['restricted'] == 1)
            Severity: Minor
            Found in includes/view/User_view.php - About 45 mins to fix

            Function Other_languages_render has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

            function Other_languages_render($user_source) {
            $other_langs = explode(",", $user_source['other_languages']);
            $xml = simplexml_load_file("https://www.facebook.com/translations/FacebookLocales.xml");
            $list = "";
            foreach($xml->xpath("/locales/locale") as $item)
            Severity: Minor
            Found in includes/view/User_view.php - About 35 mins to fix

            Avoid too many return statements within this method.
            Open

            return '<span class="text-danger moment-countdown" data-timestamp="' . $upcoming_shifts[0]['start'] . '">' . _("Shift starts %c") . '</span>';
            Severity: Major
            Found in includes/view/User_view.php - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

              return '<span class="text-danger moment-countdown" data-timestamp="' . $upcoming_shifts[0]['end'] . '">' . _("Shift ends %c") . '</span>';
              Severity: Major
              Found in includes/view/User_view.php - About 30 mins to fix

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

                if (count($tokens) > 0) {
                $match = false;
                $index = join(" ", $usr);
                foreach ($tokens as $t)
                if (stristr($index, trim($t))) {
                Severity: Minor
                Found in includes/view/User_view.php and 2 other locations - About 30 mins to fix
                includes/controller/admin_arrive_controller.php on lines 46..56
                includes/controller/admin_free_controller.php on lines 37..47

                There are no issues that match your filters.

                Category
                Status