Completed
Pull Request — master (#14)
by Саша
02:04
created

QueuedExtractor::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 6
Ratio 100 %

Importance

Changes 4
Bugs 0 Features 0
Metric Value
c 4
b 0
f 0
dl 6
loc 6
rs 9.4285
cc 1
eloc 4
nc 1
nop 3
1
<?php
2
3
namespace Extraload\Extractor;
4
5
use Ko\AmqpBroker;
6
7 View Code Duplication
class QueuedExtractor implements ExtractorInterface
8
{
9
    private $extractor;
10
    private $broker;
11
    private $proucer;
12
13
    public function __construct(ExtractorIteratorInterface $extractor, AmqpBroker $broker, $proucer)
14
    {
15
        $this->extractor = $extractor;
16
        $this->broker = $broker;
17
        $this->proucer = $proucer;
18
    }
19
20
    public function extract()
21
    {
22
        while (null !== $extracted = $this->extractor->extract()) {
23
            $this->broker->getProducer($this->proucer)->publish(serialize($extracted));
24
        }
25
    }
26
}
27