Completed
Pull Request — master (#29)
by Romain
02:25
created

CodeRequest   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 59
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

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

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 1
A buildHeaders() 0 6 1
A buildBody() 0 9 1
A buildQuery() 0 4 1
1
<?php
2
namespace Kerox\Messenger\Request;
3
4
class CodeRequest extends AbstractRequest
5
{
6
7
    /**
8
     * @var int
9
     */
10
    protected $imageSize;
11
12
    /**
13
     * @var string
14
     */
15
    protected $codeType;
16
17
    /**
18
     * CodeRequest constructor.
19
     *
20
     * @param string $pageToken
21
     * @param int $imageSize
22
     * @param string $codeType
23
     */
24 1
    public function __construct(string $pageToken, int $imageSize, string $codeType)
25
    {
26 1
        parent::__construct($pageToken);
27
28 1
        $this->imageSize = $imageSize;
29 1
        $this->codeType = $codeType;
30 1
    }
31
32
    /**
33
     * @return array
34
     */
35 1
    protected function buildHeaders(): array
36
    {
37
        return [
38 1
            'Content-Type' => 'application/json',
39
        ];
40
    }
41
42
    /**
43
     * @return array
44
     */
45 1
    protected function buildBody(): array
46
    {
47
        $body = [
48 1
            'type' => $this->codeType,
49 1
            'image_size' => $this->imageSize,
50
        ];
51
52 1
        return array_filter($body);
53
    }
54
55
    /**
56
     * @return array
57
     */
58 1
    protected function buildQuery(): array
59
    {
60 1
        return parent::buildQuery();
61
    }
62
}