Passed
Push — develop ( 7d6347...bbcebd )
by Nikita
06:10
created

GameModRepository   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Test Coverage

Coverage 30%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 3
eloc 7
c 2
b 0
f 0
dl 0
loc 22
ccs 3
cts 10
cp 0.3
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getAll() 0 3 1
A getIdNameListForGame() 0 6 1
A __construct() 0 3 1
1
<?php
2
3
namespace Gameap\Repositories;
4
5
use Gameap\Models\GameMod;
6
7
class GameModRepository extends Repository
8
{
9 9
    public function __construct(GameMod $gameMod)
10
    {
11 9
        $this->model = $gameMod;
12 9
    }
13
14
    public function getAll($perPage = 20)
15
    {
16
        return GameMod::orderBy('id')->paginate($perPage);
17
    }
18
19
    /**
20
     * @param string $gameCode
21
     * @return array
22
     */
23
    public function getIdNameListForGame(string $gameCode)
24
    {
25
        return $this->model->select('id', 'name')
26
            ->where('game_code', '=', $gameCode)
27
            ->orderBy('name')
28
            ->get();
29
    }
30
}