ModelUpdaterBuilder::withModel()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 5
ccs 0
cts 3
cp 0
crap 2
rs 10
c 0
b 0
f 0
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
    /**
13
     * @return $this
14
     */
15
    public function withModel(object $model): ModelUpdaterBuilder
16
    {
17
        $this->model = $model;
18
19
        return $this;
20
    }
21
22
    public function build(): ModelUpdater
23
    {
24
        return new ModelUpdater(
25
            $this->name,
26
            $this->fields,
27
            $this->model,
28
            $this->repository,
29
            $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

29
            /** @scrutinizer ignore-type */ $this->updateMethod,
Loading history...
30
            $this->commitMethod,
31
        );
32
    }
33
}
34