Completed
Push — master ( b64b55...d0b729 )
by Pieter
02:32
created

BaseRequest::getMethod()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php declare(strict_types=1);
2
3
namespace PeeHaa\AsyncTwitter\Api\Request;
4
5
use PeeHaa\AsyncTwitter\Request\Parameter;
6
use PeeHaa\AsyncTwitter\Request\Url;
7
8
abstract class BaseRequest implements Request
9
{
10
    private $method;
11
12
    private $endpoint;
13
14
    protected $parameters = [];
15
16 77
    public function __construct(string $method, string $endpoint)
17
    {
18 77
        $this->method   = $method;
19 77
        $this->endpoint = $endpoint;
20 77
    }
21
22 1
    public function getMethod(): string
23
    {
24 1
        return $this->method;
25
    }
26
27 38
    public function getParameters(): array
28
    {
29 38
        $parameters = [];
30
31 38
        foreach ($this->parameters as $key => $value) {
32 38
            $parameters[] = new Parameter($key, $value);
33
        }
34
35 38
        return $parameters;
36
    }
37
38 1
    public function getEndpoint(): Url
39
    {
40 1
        return new Url($this->endpoint);
41
    }
42
}
43