LazyPlumber   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
dl 0
loc 34
ccs 0
cts 11
cp 0
rs 10
c 0
b 0
f 0
wmc 3
lcom 1
cbo 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 9 1
A pour() 0 8 2
1
<?php
2
declare(strict_types=1);
3
4
namespace SlayerBirden\DataFlow;
5
6
/**
7
 * This plumber is laze. It delegates pouring to others using emitter;
8
 * Can be used for concurrency.
9
 */
10
class LazyPlumber
11
{
12
    /**
13
     * @var ProviderInterface
14
     */
15
    private $provider;
16
    /**
17
     * @var PipeLineInterface
18
     */
19
    private $pipeLine;
20
    /**
21
     * @var EmitterInterface
22
     */
23
    private $emitter;
24
25
    public function __construct(
26
        ProviderInterface $provider,
27
        PipeLineInterface $pipeLine,
28
        EmitterInterface $emitter
29
    ) {
30
        $this->provider = $provider;
31
        $this->pipeLine = $pipeLine;
32
        $this->emitter = $emitter;
33
    }
34
35
    public function pour(): void
36
    {
37
        $provider = $this->provider->getCask();
38
        foreach ($provider as $dataBag) {
39
            $this->emitter->emit('pour', $dataBag, $this->pipeLine);
40
        }
41
        $this->emitter->emit('empty_cask');
42
    }
43
}
44