Passed
Push — master ( 1ffd02...b93f0b )
by Bertrand
06:21
created

ListRepositorySql::getByType()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 6
c 1
b 0
f 0
nc 1
nop 2
dl 0
loc 8
rs 10
1
<?php
2
3
4
namespace App\Src\UseCases\Infra\Sql;
5
6
7
use App\Src\UseCases\Domain\Ports\ListRepository;
8
use Illuminate\Support\Facades\DB;
9
10
class ListRepositorySql implements ListRepository
11
{
12
    public function getByType(string $type, bool $isMain): array
13
    {
14
        $list = DB::table('list')
15
            ->where('type', $type)
16
            ->where('main', $isMain)
17
            ->orderBy('priority')
18
            ->get();
19
        return $list->toArray();
20
    }
21
}
22