jhuesser/bzu-jodel-clone

View on GitHub
functions/votes.php

Summary

Maintainability
C
1 day
Test Coverage

Showing 12 of 12 total issues

Function voteJodel has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

function voteJodel($jodel2vote, $how2vote){
global $apiroot, $baseurl, $config;
//Get the post to upvote and users who voted this post
$callurl = $apiroot . "jodels?transform=1&filter=jodelID,eq," . $jodel2vote;
$jodeljson = getCall($callurl);
Severity: Minor
Found in functions/votes.php - About 2 hrs to fix

Function voteComment has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

function voteComment( $comment2vote, $how2vote){
global $apiroot, $baseurl, $config;
$userid = $_SESSION['userid'];
$apiroot = $config->apiUrl;
$commentsjson = getCall($apiroot . "comments?transform=1&filter=commentID,eq," . $comment2vote);
Severity: Minor
Found in functions/votes.php - About 2 hrs to fix

Method voteComment has 65 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function voteComment( $comment2vote, $how2vote){
global $apiroot, $baseurl, $config;
$userid = $_SESSION['userid'];
$apiroot = $config->apiUrl;
$commentsjson = getCall($apiroot . "comments?transform=1&filter=commentID,eq," . $comment2vote);
Severity: Major
Found in functions/votes.php - About 2 hrs to fix

Method voteJodel has 63 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function voteJodel($jodel2vote, $how2vote){
global $apiroot, $baseurl, $config;
//Get the post to upvote and users who voted this post
$callurl = $apiroot . "jodels?transform=1&filter=jodelID,eq," . $jodel2vote;
$jodeljson = getCall($callurl);
Severity: Major
Found in functions/votes.php - About 2 hrs to fix

The function voteJodel() has an NPath complexity of 435. The configured NPath complexity threshold is 200.
Open

function voteJodel($jodel2vote, $how2vote){
global $apiroot, $baseurl, $config;
//Get the post to upvote and users who voted this post
$callurl = $apiroot . "jodels?transform=1&filter=jodelID,eq," . $jodel2vote;
$jodeljson = getCall($callurl);
Severity: Minor
Found in functions/votes.php by phpmd

The function voteComment() has an NPath complexity of 435. The configured NPath complexity threshold is 200.
Open

function voteComment( $comment2vote, $how2vote){
global $apiroot, $baseurl, $config;
$userid = $_SESSION['userid'];
$apiroot = $config->apiUrl;
$commentsjson = getCall($apiroot . "comments?transform=1&filter=commentID,eq," . $comment2vote);
Severity: Minor
Found in functions/votes.php by phpmd

The function voteJodel() has a Cyclomatic Complexity of 13. The configured cyclomatic complexity threshold is 10.
Open

function voteJodel($jodel2vote, $how2vote){
global $apiroot, $baseurl, $config;
//Get the post to upvote and users who voted this post
$callurl = $apiroot . "jodels?transform=1&filter=jodelID,eq," . $jodel2vote;
$jodeljson = getCall($callurl);
Severity: Minor
Found in functions/votes.php by phpmd

The function voteComment() has a Cyclomatic Complexity of 13. The configured cyclomatic complexity threshold is 10.
Open

function voteComment( $comment2vote, $how2vote){
global $apiroot, $baseurl, $config;
$userid = $_SESSION['userid'];
$apiroot = $config->apiUrl;
$commentsjson = getCall($apiroot . "comments?transform=1&filter=commentID,eq," . $comment2vote);
Severity: Minor
Found in functions/votes.php by phpmd

Avoid unused local variables such as '$uservoted'.
Confirmed

$uservoted = postCall($callurl,$postfields);
Severity: Minor
Found in functions/votes.php by phpmd

Avoid unused local variables such as '$karmaupdated'.
Open

$karmaupdated = putCall($callurl, $postfields);
Severity: Minor
Found in functions/votes.php by phpmd

Avoid unused local variables such as '$karmaupdated'.
Open

$karmaupdated = putCall($callurl, $postfields);
Severity: Minor
Found in functions/votes.php by phpmd

Avoid unused local variables such as '$uservoted'.
Confirmed

$uservoted = postCall($callurl,$postfields);
Severity: Minor
Found in functions/votes.php by phpmd
Category
Status