ReadEventStreamFeedRequestFactory   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1
Metric Value
wmc 2
lcom 1
cbo 1
dl 0
loc 33
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A buildRequest() 0 11 1
1
<?php
2
3
namespace RayRutjes\GetEventStore\Client\Http;
4
5
use GuzzleHttp\Psr7\Request;
6
use Psr\Http\Message\RequestInterface;
7
8
final class ReadEventStreamFeedRequestFactory implements RequestFactoryInterface
9
{
10
    const EMBED = 'embed';
11
    const EMBED_BODY = 'body';
12
13
    /**
14
     * @var string
15
     */
16
    private $uri;
17
18
    /**
19
     * @param string $uri
20
     */
21
    public function __construct(string $uri)
22
    {
23
        $this->uri = $uri;
24
    }
25
26
    /**
27
     * @return RequestInterface
28
     */
29
    public function buildRequest(): RequestInterface
30
    {
31
        return new Request(
32
            'GET',
33
            // Add full event entries to the feed.
34
            $this->uri . '?' . self::EMBED . '=' . self::EMBED_BODY,
35
            [
36
                RequestHeader::ACCEPT => ContentType::ATOM_JSON,
37
            ]
38
        );
39
    }
40
}
41