Completed
Push — master ( 09e519...2e0c76 )
by Vincent
01:56
created

Request   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 50
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
c 1
b 0
f 0
lcom 1
cbo 2
dl 0
loc 50
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A send() 0 4 1
1
<?php
2
/**
3
 * BongaTech SMS Client Library for PHP.
4
 *
5
 * @copyright Copyright (c) 2017
6
 * @author   Vincent Mosoti <[email protected]>
7
 * @license https://github.com/VMosoti/bongatech-sms/blob/master/LICENSE
8
 */
9
10
namespace VMosoti\BongaTech;
11
12
use Unirest\Request\Body;
13
use Unirest\Request as UniRequest;
14
15
class Request
16
{
17
    /**
18
     * the request url.
19
     *
20
     * @var string
21
     */
22
    public $endpoint;
23
    /**
24
     * request headers.
25
     *
26
     * @var array
27
     */
28
    public $headers;
29
30
    /**
31
     * request body.
32
     *
33
     * @var array
34
     */
35
    public $body;
36
37
    /**
38
     * the response is in form of a string.
39
     *
40
     * @var array
41
     */
42
    public $response;
43
44
    /**
45
     * Request constructor.
46
     *
47
     * @param  $endpoint
48
     * @param array $headers
49
     * @param array $body
50
     */
51
    public function __construct($endpoint, array $headers, array $body)
52
    {
53
        $this->endpoint = $endpoint;
54
        $this->headers = $headers;
55
        $this->body = $body;
56
    }
57
58
    public function send()
59
    {
60
        return UniRequest::post($this->endpoint, $this->headers, Body::Json($this->body));
61
    }
62
63
64
}
65