AbstractHttpAdapter   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
c 1
b 0
f 0
dl 0
loc 42
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A sendRequest() 0 5 1
1
<?php
2
3
/**
4
 * MIT License
5
 * Use of this software requires acceptance of the Evaluation License Agreement. See LICENSE file.
6
 */
7
8
namespace SprykerEco\Zed\Ratepay\Business\Api\Adapter\Http;
9
10
use SprykerEco\Zed\Ratepay\Business\Api\Adapter\AdapterInterface;
11
12
abstract class AbstractHttpAdapter implements AdapterInterface
13
{
14
    /**
15
     * @var string
16
     */
17
    protected $gatewayUrl;
18
19
    /**
20
     * @param string $gatewayUrl
21
     */
22
    public function __construct($gatewayUrl)
23
    {
24
        $this->gatewayUrl = $gatewayUrl;
25
    }
26
27
    /**
28
     * @param string $data
29
     *
30
     * @return string
31
     */
32
    public function sendRequest($data)
33
    {
34
        $request = $this->buildRequest($data);
35
36
        return $this->send($request);
37
    }
38
39
    /**
40
     * @param string $data
41
     *
42
     * @return object
43
     */
44
    abstract protected function buildRequest($data);
45
46
    /**
47
     * @param object $request
48
     *
49
     * @throws \SprykerEco\Zed\Ratepay\Business\Exception\ApiHttpRequestException
50
     *
51
     * @return string
52
     */
53
    abstract protected function send($request);
54
}
55