FetchOrder   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 6
eloc 7
c 2
b 0
f 0
dl 0
loc 31
rs 10

6 Methods

Rating   Name   Duplication   Size   Complexity  
A getXml() 0 3 1
A getHeaders() 0 4 1
A isExpectXml() 0 3 1
A __construct() 0 3 1
A getUrl() 0 3 1
A getMethod() 0 3 1
1
<?php
2
declare(strict_types=1);
3
4
namespace Bpost\BpostApiClient\Bpost\HttpRequestBuilder;
5
6
use Bpost\BpostApiClient\Common\ApiVersions;
7
8
class FetchOrder implements HttpRequestBuilderInterface
9
{
10
    public function __construct(
11
        private readonly string $reference
12
    ) {}
13
14
    public function getXml(): ?string
15
    {
16
        return null;
17
    }
18
19
    public function getHeaders(): array
20
    {
21
        return [
22
            'Accept: application/vnd.bpost.shm-order-' . ApiVersions::V3_3 . '+XML',
23
        ];
24
    }
25
26
    public function getUrl(): string
27
    {
28
        return '/orders/' . $this->reference;
29
    }
30
31
    public function isExpectXml(): bool
32
    {
33
        return true;
34
    }
35
36
    public function getMethod(): string
37
    {
38
        return self::METHOD_GET;
39
    }
40
}