AbstractRepository::findMany()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 2
cp 0
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 2
crap 2
1
<?php
2
3
4
namespace Mvdstam\Oauth2ServerLaravel\Repositories;
5
6
7
use Czim\Repository\BaseRepository;
8
use Illuminate\Database\Eloquent\Model;
9
10
abstract class AbstractRepository extends BaseRepository
11
{
12
13
    /**
14
     * @param array $data
15
     * @return Model
16
     */
17 5
    public function forceCreate(array $data = [])
18
    {
19 5
        $model = $this->makeModel(false)->forceFill($data);
20 5
        $model->save();
21
22 5
        return $model;
23
    }
24
25 11
    public function findWhere($where, $columns = ['*'], $or = false)
26
    {
27
        // Ensure a collection is returned
28 11
        return parent::findWhere($where, $columns, $or) ?: collect();
0 ignored issues
show
Bug Compatibility introduced by
The expression parent::findWhere($where...mns, $or) ?: collect(); of type Illuminate\Database\Eloq...nate\Support\Collection adds the type Illuminate\Database\Eloquent\Builder[] to the return on line 28 which is incompatible with the return type declared by the interface Czim\Repository\Contract...oryInterface::findWhere of type Illuminate\Support\Collection|null.
Loading history...
29
    }
30
31
    public function findMany($ids, $columns = ['*'])
32
    {
33
        return $this->query()->findMany($ids, $columns);
34
    }
35
36
}
37