Passed
Push — main ( b96c2d...30a05e )
by Richard
04:40
created

PlayerGameController::showPlayers()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 6
c 1
b 0
f 0
dl 0
loc 8
rs 10
cc 2
nc 2
nop 2
1
<?php
2
3
namespace Furic\GameEssentials\Http\Controllers;
4
5
use Furic\GameEssentials\Models\PlayerGame;
6
use App\Http\Controllers\Controller;
0 ignored issues
show
Bug introduced by
The type App\Http\Controllers\Controller was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
7
use Illuminate\Http\Request;
8
9
class PlayerGameController extends Controller
10
{
11
12
    /**
13
     * Display a listing of the player resource by a given game ID.
14
     *
15
     * @return \Illuminate\Http\Response
16
     */
17
    public function showPlayers(Request $request, $gameId)
18
    {
19
        $max = $request->max;
20
        $players = PlayerGame::getPlayers($gameId);
21
        if ($max <= 0) {
22
            return response($players->get(), 200);
23
        } else {
24
            return response($players->take($max)->get(), 200);
25
        } 
26
    }
27
28
}
29