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

AbstractModelUpdaterBuilder   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 54
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 16
c 1
b 0
f 0
dl 0
loc 54
ccs 0
cts 15
cp 0
rs 10
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
    public function withName(string $name): self
27
    {
28
        $this->name = $name;
29
30
        return $this;
31
    }
32
33
    public function withFields(?array $fields): self
34
    {
35
        $this->fields = $fields;
36
37
        return $this;
38
    }
39
40
    public function withRepository(object $repository): self
41
    {
42
        $this->repository = $repository;
43
44
        return $this;
45
    }
46
47
    public function withUpdateMethod(?string $updateMethod): self
48
    {
49
        $this->updateMethod = $updateMethod;
50
51
        return $this;
52
    }
53
54
    public function withCommitMethod(?string $commitMethod): self
55
    {
56
        $this->commitMethod = $commitMethod;
57
58
        return $this;
59
    }
60
}
61