Barista::makeCoffee()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 8
ccs 6
cts 6
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\Structural\Facade;
5
6
/**
7
 * Class Barista
8
 * @package codenixsv\Patterns\Structural\Facade
9
 */
10
class Barista
11
{
12
    /**
13
     * @var CoffeeGrinderInterface
14
     */
15
    private $coffeeGrinder;
16
17
    /**
18
     * @var CoffeeMachineInterface
19
     */
20
    private $coffeeMachine;
21
22
    /**
23
     * Barista constructor.
24
     * @param CoffeeGrinderInterface $coffeeGrinder
25
     * @param CoffeeMachineInterface $coffeeMachine
26
     */
27 1
    public function __construct(CoffeeGrinderInterface $coffeeGrinder, CoffeeMachineInterface $coffeeMachine)
28
    {
29 1
        $this->coffeeGrinder = $coffeeGrinder;
30 1
        $this->coffeeMachine = $coffeeMachine;
31 1
    }
32
33 1
    public function makeCoffee()
34
    {
35 1
        $this->coffeeGrinder->load();
36 1
        $this->coffeeGrinder->grind();
37
38 1
        $this->coffeeMachine->load();
39 1
        $this->coffeeMachine->make();
40 1
    }
41
}
42