BaseRequest::getMethod()   A
last analyzed

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\FieldParameter;
6
use PeeHaa\AsyncTwitter\Request\Url;
7
8
abstract class BaseRequest implements Request
9
{
10
    const BASE_URL = 'https://api.twitter.com/1.1';
11
12
    private $method;
13
14
    private $endpoint;
15
16
    protected $parameters = [];
17
18 339
    public function __construct(string $method, string $endpoint)
19
    {
20 339
        $this->method   = $method;
21 339
        $this->endpoint = $endpoint;
22
    }
23
24 1
    public function getMethod(): string
25
    {
26 1
        return $this->method;
27
    }
28
29 183
    public function getParameters(): array
30
    {
31 183
        $parameters = [];
32
33 183
        foreach ($this->parameters as $key => $value) {
34 183
            $parameters[] = new FieldParameter($key, $value);
35
        }
36
37 183
        return $parameters;
38
    }
39
40 13
    public function getEndpoint(): Url
41
    {
42 13
        return new Url(static::BASE_URL, $this->endpoint);
43
    }
44
45
    public function handleResponse(array $responseData)
46
    {
47
        return $responseData;
48
    }
49
}
50