AbstractModelUpdaterBuilder   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 69
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
eloc 16
dl 0
loc 69
ccs 0
cts 15
cp 0
rs 10
c 0
b 0
f 0
wmc 5

5 Methods

Rating   Name   Duplication   Size   Complexity  
A withCommitMethod() 0 5 1
A withName() 0 5 1
A withFields() 0 5 1
A withUpdateMethod() 0 5 1
A withRepository() 0 5 1
1
<?php
2
3
namespace WebTheory\Saveyour\Processor\Builder\Abstracts;
4
5
class AbstractModelUpdaterBuilder
6
{
7
    protected string $name;
8
9
    protected ?array $fields = [];
10
11
    /**
12
     * Instance of model repository
13
     */
14
    protected object $repository;
15
16
    /**
17
     * Optional method for updating the model in the repository
18
     */
19
    protected ?string $updateMethod = null;
20
21
    /**
22
     * Optional method for committing repository changes to database
23
     */
24
    protected ?string $commitMethod = null;
25
26
    /**
27
     * @return $this
28
     */
29
    public function withName(string $name): AbstractModelUpdaterBuilder
30
    {
31
        $this->name = $name;
32
33
        return $this;
34
    }
35
36
    /**
37
     * @return $this
38
     */
39
    public function withFields(?array $fields): AbstractModelUpdaterBuilder
40
    {
41
        $this->fields = $fields;
42
43
        return $this;
44
    }
45
46
    /**
47
     * @return $this
48
     */
49
    public function withRepository(object $repository): AbstractModelUpdaterBuilder
50
    {
51
        $this->repository = $repository;
52
53
        return $this;
54
    }
55
56
    /**
57
     * @return $this
58
     */
59
    public function withUpdateMethod(?string $updateMethod): AbstractModelUpdaterBuilder
60
    {
61
        $this->updateMethod = $updateMethod;
62
63
        return $this;
64
    }
65
66
    /**
67
     * @return $this
68
     */
69
    public function withCommitMethod(?string $commitMethod): AbstractModelUpdaterBuilder
70
    {
71
        $this->commitMethod = $commitMethod;
72
73
        return $this;
74
    }
75
}
76