fossasia/engelsystem

View on GitHub
includes/controller/user_news_controller.php

Summary

Maintainability
C
1 day
Test Coverage

Showing 7 of 7 total issues

Function user_news has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

function user_news() {
global $DISPLAY_NEWS, $privileges, $user;
 
$html = '<div class="col-md-12"><h1>' . news_title() . '</h1>' . msg();
 
 
Severity: Minor
Found in includes/controller/user_news_controller.php - About 1 hr to fix

Method user_news has 40 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function user_news() {
global $DISPLAY_NEWS, $privileges, $user;
 
$html = '<div class="col-md-12"><h1>' . news_title() . '</h1>' . msg();
 
 
Severity: Minor
Found in includes/controller/user_news_controller.php - About 1 hr to fix

    Method user_news_comments has 34 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function user_news_comments() {
    global $user;
     
    $html = '<div class="col-md-12"><h1>' . user_news_comments_title() . '</h1>';
    if (isset($_REQUEST["nid"]) && preg_match("/^[0-9]{1,}$/", $_REQUEST['nid']) && count_news_by_id($_REQUEST['nid']) > 0) {
    Severity: Minor
    Found in includes/controller/user_news_controller.php - About 1 hr to fix

      Function user_news_comments has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

      function user_news_comments() {
      global $user;
       
      $html = '<div class="col-md-12"><h1>' . user_news_comments_title() . '</h1>';
      if (isset($_REQUEST["nid"]) && preg_match("/^[0-9]{1,}$/", $_REQUEST['nid']) && count_news_by_id($_REQUEST['nid']) > 0) {
      Severity: Minor
      Found in includes/controller/user_news_controller.php - About 1 hr to fix

      Function user_meetings has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

      function user_meetings() {
      global $DISPLAY_NEWS, $privileges, $user;
       
      $html = '<div class="col-md-12"><h1>' . meetings_title() . '</h1>' . msg();
       
       
      Severity: Minor
      Found in includes/controller/user_news_controller.php - About 1 hr to fix

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

      for ($i = 0; $i < $dis_rows; $i ++) {
      if (isset($_REQUEST['page']) && $i == $_REQUEST['page'])
      $html .= '<li class="active">';
      elseif (! isset($_REQUEST['page']) && $i == 0)
      $html .= '<li class="active">';
      Severity: Major
      Found in includes/controller/user_news_controller.php and 1 other location - About 2 hrs to fix
      includes/controller/user_news_controller.php on lines 30..38

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

      for ($i = 0; $i < $dis_rows; $i ++) {
      if (isset($_REQUEST['page']) && $i == $_REQUEST['page'])
      $html .= '<li class="active">';
      elseif (! isset($_REQUEST['page']) && $i == 0)
      $html .= '<li class="active">';
      Severity: Major
      Found in includes/controller/user_news_controller.php and 1 other location - About 2 hrs to fix
      includes/controller/user_news_controller.php on lines 141..149
      Category
      Status