Completed
Pull Request — master (#14)
by Саша
05:23 queued 03:13
created

QueuedExtractor::extract()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
c 2
b 0
f 0
dl 0
loc 6
rs 9.4285
cc 2
eloc 3
nc 2
nop 0
1
<?php
2
3
namespace Extraload\Extractor;
4
5
use Ko\AmqpBroker;
6
7
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