KeyValueBuilder   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 1
dl 0
loc 29
ccs 10
cts 10
cp 1
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A create() 0 4 1
A add() 0 6 1
A build() 0 4 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