Completed
Push — master ( 74ffa0...ed410a )
by Mariano
10:21
created

AbstractBuilder   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 90.91%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 28
wmc 4
lcom 1
cbo 0
ccs 10
cts 11
cp 0.9091
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A withName() 0 6 1
A withArgument() 0 5 1
A build() 0 9 2
1
<?php
2
namespace Mcustiel\PowerRoute\Utils;
3
4
abstract class AbstractBuilder
5
{
6
    private $name;
7
    private $argument;
8
9 1
    public function withName($name)
10
    {
11 1
        $this->name = $name;
12
13 1
        return $this;
14
    }
15
16 1
    public function withArgument($argument)
17
    {
18 1
        $this->argument = $argument;
19 1
        return $this;
20
    }
21
22 1
    public function build()
23
    {
24 1
        if (empty($this->name)) {
25
            throw new \RuntimeException('Actions, Matchers and InputSources should be identified by a name');
26
        }
27
        return [
28 1
            $this->name => $this->argument
29 1
        ];
30
    }
31
}
32