TransportReceiveContextFactory   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 4
dl 0
loc 30
ccs 13
cts 13
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A createFromPushContext() 0 14 1
1
<?php
2
namespace PSB\Core\Transport;
3
4
5
use PSB\Core\ObjectBuilder\BuilderInterface;
6
use PSB\Core\Pipeline\Incoming\StageContext\TransportReceiveContext;
7
use PSB\Core\Pipeline\PipelineRootStageContext;
8
9
class TransportReceiveContextFactory
10
{
11
    /**
12
     * @var BuilderInterface
13
     */
14
    private $builder;
15
16
    /**
17
     * @param BuilderInterface $builder
18
     */
19 2
    public function __construct(BuilderInterface $builder)
20
    {
21 2
        $this->builder = $builder;
22 2
    }
23
24 1
    public function createFromPushContext(PushContext $pushContext)
25
    {
26 1
        return new TransportReceiveContext(
27 1
            $pushContext->getMessageId(),
28 1
            new IncomingPhysicalMessage(
29 1
                $pushContext->getMessageId(),
30 1
                $pushContext->getHeaders(),
31 1
                $pushContext->getBody()
32
            ),
33 1
            $pushContext->getCancellationToken(),
34 1
            $pushContext->getEndpointControlToken(),
35 1
            new PipelineRootStageContext($this->builder)
36
        );
37
    }
38
}
39