PizzaBuilder::addPeperoni()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 5
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 1
1
<?php
2
declare(strict_types=1);
3
4
namespace codenixsv\Patterns\Creational\Builder;
5
6
/**
7
 * Class PizzaBuilder
8
 * @package codenixsv\Patterns\Creational\Builder
9
 */
10
class PizzaBuilder
11
{
12
    /**
13
     * @var bool
14
     */
15
    public $peperoni = false;
16
17
    /**
18
     * @var bool
19
     */
20
    public $tomato = false;
21
22
    /**
23
     * @var bool
24
     */
25
    public $anchovy = false;
26
27
    /**
28
     * @var bool
29
     */
30
    public $mozzarella = false;
31
32
    /**
33
     * @var bool
34
     */
35
    public $salami = false;
36
37
38
    /**
39
     * @return $this
40
     */
41 1
    public function addPeperoni()
42
    {
43 1
        $this->peperoni = true;
44 1
        return $this;
45
    }
46
47
    /**
48
     * @return $this
49
     */
50
    public function addTomato()
51
    {
52
        $this->tomato = true;
53
        return $this;
54
    }
55
56
    /**
57
     * @return $this
58
     */
59 1
    public function addAnchovy()
60
    {
61 1
        $this->anchovy = true;
62 1
        return $this;
63
    }
64
65
    /**
66
     * @return $this
67
     */
68
    public function addMozzarella()
69
    {
70
        $this->mozzarella = true;
71
        return $this;
72
    }
73
74
    /**
75
     * @return $this
76
     */
77
    public function addSalami()
78
    {
79
        $this->salami = true;
80
        return $this;
81
    }
82
83
    /**
84
     * @return Pizza
85
     */
86 1
    public function build()
87
    {
88 1
        return new Pizza($this);
89
    }
90
}
91