AbstractHttpAdapter::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 3
rs 10
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