Passed
Push — master ( e1c5c8...a48a63 )
by Guillermo A.
08:16
created

AbstractRepository::raiseBadMethodCallException()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 4
ccs 3
cts 3
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Guillermoandrae\Repositories;
4
5
use Guillermoandrae\Common\DumpableTrait;
6
use Guillermoandrae\Models\ModelInterface;
7
8
abstract class AbstractRepository implements RepositoryInterface
9
{
10
    use DumpableTrait;
11
12
    protected $options;
13
14 7
    public function __construct($options = null)
15
    {
16 7
        $this->options = $options;
17 7
    }
18
19 1
    public function find($id): ModelInterface
20
    {
21 1
        return $this->findById($id);
22 1
    }
23
24
    public function findById($id): ModelInterface
25 1
    {
26
        $collection = $this->findWhere(['id' => $id]);
27 1
        return $collection->first();
28
    }
29
}
30