irfaardy/php-gacha

View on GitHub

Showing 158 of 160 total issues

Function get has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Confirmed

    protected static function get($items) {
        if (is_array($items))
        {
            $max = 0;
            foreach ($items as $key => $value) {
Severity: Minor
Found in src/Roulette/Roulette.php - About 1 hr to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Spaces must be used for alignment; tabs are not allowed
Open

    private function calc_rate($item_list, $items, $rate)
Severity: Minor
Found in src/Roulette/RateUp.php by phpcodesniffer

Spaces must be used for alignment; tabs are not allowed
Open

        }
Severity: Minor
Found in src/Roulette/RateUp.php by phpcodesniffer

Opening brace of a class must be on the line after the definition
Open

class Roll extends Roulette {
Severity: Minor
Found in src/Roll.php by phpcodesniffer

The closing brace for the class must go on the next line after the body
Open

}
Severity: Minor
Found in src/Roulette/Roulette.php by phpcodesniffer

The closing brace for the class must go on the next line after the body
Open

}
Severity: Minor
Found in src/Roll.php by phpcodesniffer

Spaces must be used for alignment; tabs are not allowed
Open

        $item = [];
Severity: Minor
Found in src/Roulette/RateUp.php by phpcodesniffer

Opening brace of a class must be on the line after the definition
Open

class RateUp {
Severity: Minor
Found in src/Roulette/RateUp.php by phpcodesniffer

Spaces must be used for alignment; tabs are not allowed
Open

        {
Severity: Minor
Found in src/Roulette/RateUp.php by phpcodesniffer

Spaces must be used for alignment; tabs are not allowed
Open

        if (is_array($items))
Severity: Minor
Found in src/Roulette/RateUp.php by phpcodesniffer

Spaces must be used for alignment; tabs are not allowed
Open

                $item[$itm] = $item_list[$itm] * ($rate / 100);
Severity: Minor
Found in src/Roulette/RateUp.php by phpcodesniffer

Spaces must be used for alignment; tabs are not allowed
Open

        return $rt->calc_rate($item_list, $items, $rate);        
Severity: Minor
Found in src/Roulette/RateUp.php by phpcodesniffer

Spaces must be used for alignment; tabs are not allowed
Open

            foreach ($items as $itm)
Severity: Minor
Found in src/Roulette/RateUp.php by phpcodesniffer

Spaces must be used for alignment; tabs are not allowed
Open

            }
Severity: Minor
Found in src/Roulette/RateUp.php by phpcodesniffer

Spaces must be used for alignment; tabs are not allowed
Open

    }
Severity: Minor
Found in src/Roulette/RateUp.php by phpcodesniffer

Spaces must be used for alignment; tabs are not allowed
Open

        } else {
Severity: Minor
Found in src/Roulette/RateUp.php by phpcodesniffer

Spaces must be used for alignment; tabs are not allowed
Open

            {
Severity: Minor
Found in src/Roulette/RateUp.php by phpcodesniffer

Opening brace of a class must be on the line after the definition
Open

class Roulette extends RateUp {
Severity: Minor
Found in src/Roulette/Roulette.php by phpcodesniffer

Method name "_itemDropUp" should not be prefixed with an underscore to indicate visibility
Open

    protected static function _itemDropUp($item_list, $items, $rate)
Severity: Minor
Found in src/Roulette/RateUp.php by phpcodesniffer

Spaces must be used for alignment; tabs are not allowed
Open

                $item[$items] = $item_list[$items] * ($rate / 100);
Severity: Minor
Found in src/Roulette/RateUp.php by phpcodesniffer
Severity
Category
Status
Source
Language