Passed
Push — master ( 151cc0...3583a4 )
by Romain
49s
created

PersonaRequest   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
eloc 7
dl 0
loc 36
ccs 8
cts 8
cp 1
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A buildBody() 0 3 2
A __construct() 0 5 1
A buildHeaders() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Kerox\Messenger\Request;
6
7
use Kerox\Messenger\Model\Persona;
8
9
class PersonaRequest extends AbstractRequest
10
{
11
    /**
12
     * @var Persona|null
13
     */
14
    protected $persona;
15
16
    /**
17
     * PersonaRequest constructor.
18
     *
19
     * @param string       $pageToken
20
     * @param Persona|null $persona
21
     */
22 4
    public function __construct(string $pageToken, ?Persona $persona = null)
23
    {
24 4
        parent::__construct($pageToken);
25
26 4
        $this->persona = $persona;
27 4
    }
28
29
    /**
30
     * @return mixed
31
     */
32 4
    protected function buildHeaders()
33
    {
34
        return [
35 4
            'Content-Type' => 'application/json',
36
        ];
37
    }
38
39
    /**
40
     * @return mixed
41
     */
42 4
    protected function buildBody()
43
    {
44 4
        return $this->persona ?: '';
45
    }
46
}
47