Passed
Push — master ( 2ea67c...f4db78 )
by Chris
39:33
created

ModelUpdaterBuilder::build()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 7
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 9
ccs 0
cts 8
cp 0
crap 2
rs 10
1
<?php
2
3
namespace WebTheory\Saveyour\Processor\Builder;
4
5
use WebTheory\Saveyour\Processor\Builder\Abstracts\AbstractModelUpdaterBuilder;
6
use WebTheory\Saveyour\Processor\ModelUpdater;
7
8
class ModelUpdaterBuilder extends AbstractModelUpdaterBuilder
9
{
10
    protected object $model;
11
12
    public function withModel(object $model): self
13
    {
14
        $this->model = $model;
15
16
        return $this;
17
    }
18
19
    public function build(): ModelUpdater
20
    {
21
        return new ModelUpdater(
22
            $this->name,
23
            $this->fields,
24
            $this->model,
25
            $this->repository,
26
            $this->updateMethod,
0 ignored issues
show
Bug introduced by
It seems like $this->updateMethod can also be of type null; however, parameter $updateMethod of WebTheory\Saveyour\Proce...lUpdater::__construct() does only seem to accept string, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

26
            /** @scrutinizer ignore-type */ $this->updateMethod,
Loading history...
27
            $this->commitMethod,
28
        );
29
    }
30
}
31