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

QueuedExtractor   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 4
Bugs 0 Features 0
Metric Value
c 4
b 0
f 0
dl 0
loc 20
wmc 3
lcom 1
cbo 3
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A extract() 0 6 2
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