Passed
Push — master ( c4dd73...eb2b77 )
by Victor Hugo
02:30
created

AbstractPhraseappResource   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
eloc 5
dl 0
loc 35
ccs 7
cts 7
cp 1
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A execute() 0 3 1
A buildRequest() 0 3 1
A __construct() 0 3 1
1
<?php
2
3
namespace VictorAvelar\Phraseapp\Resources;
4
5
use GuzzleHttp\Psr7\Request;
6
use VictorAvelar\Phraseapp\Contracts\ExecutorInterface;
7
use VictorAvelar\Phraseapp\PhraseappHttpClient;
8
9
abstract class AbstractPhraseappResource implements ExecutorInterface
10
{
11
    /**
12
     * @var PhraseappHttpClient
13
     */
14
    private $client;
15
16
    /**
17
     * AbstractPhraseappResource constructor.
18
     * @param PhraseappHttpClient $client
19
     */
20 6
    public function __construct(PhraseappHttpClient $client)
21
    {
22 6
        $this->client = $client;
23 6
    }
24
25
    /**
26
     * {@inheritdoc}
27
     */
28 6
    public function execute(Request $request)
29
    {
30 6
        return $this->client->send($request);
31
    }
32
33
    /**
34
     * Returns a PS7 compliant request object.
35
     *
36
     * @param string $method
37
     * @param string $uri
38
     *
39
     * @return Request
40
     */
41 6
    protected function buildRequest(string $method, string $uri)
42
    {
43 6
        return new Request($method, $uri);
44
    }
45
}
46