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

TransformerConsumer::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 6
Ratio 100 %

Importance

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