FlushListener::addFlusher()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
crap 1
1
<?php
2
3
namespace TreeHouse\QueueBundle\EventListener;
4
5
use TreeHouse\QueueBundle\Flusher\FlushingInterface;
6
7
class FlushListener
8
{
9
    /**
10
     * @var FlushingInterface[]
11
     */
12
    protected $flushers = [];
13
14
    /**
15
     * @param FlushingInterface $flusher
16
     */
17 1
    public function addFlusher(FlushingInterface $flusher)
18
    {
19 1
        $this->flushers[] = $flusher;
20 1
    }
21
22
    /**
23
     * Calls all flushers
24
     */
25 1
    public function onFlush()
26
    {
27 1
        foreach ($this->flushers as $flusher) {
28 1
            $flusher->flush();
29
        }
30 1
    }
31
}
32