TakoController   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Importance

Changes 3
Bugs 0 Features 0
Metric Value
wmc 4
c 3
b 0
f 0
lcom 0
cbo 4
dl 0
loc 26
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A filelist() 0 6 1
A getdevelopers() 0 10 2
A getMakers() 0 5 1
1
<?php
2
3
/*
4
 * rmarchiv.tk
5
 * (c) 2016-2017 by Marcel 'ryg' Hering
6
 */
7
8
namespace App\Http\Controllers\Api\v1;
9
10
use App\Models\Game;
11
use App\Models\GamesFile;
12
use App\Http\Controllers\Controller;
13
use App\Models\Maker;
14
15
class TakoController extends Controller
16
{
17
    public function filelist()
0 ignored issues
show
Documentation introduced by
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
18
    {
19
        $list = GamesFile::with('gamefiletype', 'game.maker' )->get(); //->take(5);
0 ignored issues
show
Unused Code Comprehensibility introduced by
84% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
20
21
        return $list;
22
    }
23
24
    public function getdevelopers($gameid)
0 ignored issues
show
Documentation introduced by
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
25
    {
26
        $devs = Game::whereId($gameid)->first();
27
28
        $res = [];
0 ignored issues
show
Unused Code introduced by
$res is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
29
30
        foreach ($devs->developers()->get() as $dev) {
31
            return $dev->developer->name;
32
        }
33
    }
34
35
    public function getMakers(){
36
        $maker = Maker::all();
37
38
        return $maker;
39
    }
40
}
41