fossasia/engelsystem

View on GitHub
includes/view/Shifts_view.php

Summary

Maintainability
C
1 day
Test Coverage

Showing 6 of 6 total issues

Method Shift_view has 81 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function Shift_view($shift, $shifttype, $room, $shift_admin, $angeltypes_source, $user_shift_admin, $admin_rooms, $admin_shifttypes, $user_shifts, $signed_up) {
$parsedown = new Parsedown();
 
$angeltypes = [];
foreach ($angeltypes_source as $angeltype)
Severity: Major
Found in includes/view/Shifts_view.php - About 3 hrs to fix

    Function Shift_view has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
    Open

    function Shift_view($shift, $shifttype, $room, $shift_admin, $angeltypes_source, $user_shift_admin, $admin_rooms, $admin_shifttypes, $user_shifts, $signed_up) {
    $parsedown = new Parsedown();
     
    $angeltypes = [];
    foreach ($angeltypes_source as $angeltype)
    Severity: Minor
    Found in includes/view/Shifts_view.php - About 2 hrs to fix

    Method Shift_view has 10 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    function Shift_view($shift, $shifttype, $room, $shift_admin, $angeltypes_source, $user_shift_admin, $admin_rooms, $admin_shifttypes, $user_shifts, $signed_up) {
    Severity: Major
    Found in includes/view/Shifts_view.php - About 1 hr to fix

      Function Shift_signup_button_render has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

      function Shift_signup_button_render($shift, $angeltype, $user_angeltype = null, $user_shifts = null) {
      global $user;
       
      if ($user_angeltype == null) {
      $user_angeltype = UserAngelType_by_User_and_AngelType($user, $angeltype);
      Severity: Minor
      Found in includes/view/Shifts_view.php - About 25 mins to fix

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

      div('col-sm-3 col-xs-6', [
      '<h4>' . _('Start') . '</h4>',
      '<p class="lead' . (time() >= $shift['start'] ? ' text-success' : '') . '">',
      glyph('calendar') . date('Y-m-d', $shift['start']),
      '<br />',
      Severity: Major
      Found in includes/view/Shifts_view.php and 1 other location - About 2 hrs to fix
      includes/view/Shifts_view.php on lines 95..102

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

      div('col-sm-3 col-xs-6', [
      '<h4>' . _('End') . '</h4>',
      '<p class="lead' . (time() >= $shift['end'] ? ' text-success' : '') . '">',
      glyph('calendar') . date('Y-m-d', $shift['end']),
      '<br />',
      Severity: Major
      Found in includes/view/Shifts_view.php and 1 other location - About 2 hrs to fix
      includes/view/Shifts_view.php on lines 87..94

      There are no issues that match your filters.

      Category
      Status