Completed
Push — master ( 7b6129...1e83e1 )
by Joachim
01:36
created

KeyValueBuilder::add()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 6
ccs 3
cts 3
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 2
crap 1
1
<?php
2
namespace Loevgaard\Dandomain\Api\KeyValue;
3
4
/**
5
 * The job of the key value builder is to make a fluent interface for creating a key value collection to put into the patch methods
6
 */
7
class KeyValueBuilder
0 ignored issues
show
Coding Style introduced by
Since you have declared the constructor as private, maybe you should also declare the class as final.
Loading history...
8
{
9
    /**
10
     * @var KeyValueCollection
11
     */
12
    private $keyValueCollection;
13
14 1
    private function __construct()
15
    {
16 1
        $this->keyValueCollection = new KeyValueCollection();
17 1
    }
18
19 1
    public static function create() : KeyValueBuilder
20
    {
21 1
        return new self();
22
    }
23
24 1
    public function add(string $key, string $value) : KeyValueBuilder
25
    {
26 1
        $this->keyValueCollection->add($key, $value);
27
28 1
        return $this;
29
    }
30
31 1
    public function build() : KeyValueCollection
32
    {
33 1
        return $this->keyValueCollection;
34
    }
35
}
36