PushPipe::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 5
ccs 4
cts 4
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 2
crap 1
1
<?php
2
namespace PSB\Core\Transport;
3
4
5
use PSB\Core\Pipeline\PipelineInterface;
6
7
class PushPipe
8
{
9
    /**
10
     * @var TransportReceiveContextFactory
11
     */
12
    private $contextFactory;
13
14
    /**
15
     * @var PipelineInterface
16
     */
17
    private $pipeline;
18
19
    /**
20
     * @param TransportReceiveContextFactory $contextFactory
21
     * @param PipelineInterface              $pipeline
22
     */
23 2
    public function __construct(TransportReceiveContextFactory $contextFactory, PipelineInterface $pipeline)
24
    {
25 2
        $this->contextFactory = $contextFactory;
26 2
        $this->pipeline = $pipeline;
27 2
    }
28
29
    /**
30
     * @param PushContext $pushContext
31
     */
32 1
    public function push(PushContext $pushContext)
33
    {
34 1
        $transportReceiveContext = $this->contextFactory->createFromPushContext($pushContext);
35
36 1
        $this->pipeline->invoke($transportReceiveContext);
37 1
    }
38
}
39