Setting::getCredit()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
3
namespace Cryptommer\Smsir\Classes;
4
5
use Cryptommer\Smsir\Exceptions\HttpException;
6
use Cryptommer\Smsir\Objects\CreditResponse;
7
use Cryptommer\Smsir\Objects\LineResponse;
8
use GuzzleHttp\Exception\GuzzleException;
9
use JsonException;
10
11
class Setting {
12
13
    private $smsir;
14
15
    /**
16
     * @param Smsir $smsir
17
     */
18
    public function __construct(Smsir $smsir) {
19
        $this->smsir = $smsir;
20
    }
21
22
    /**
23
     * get account credit
24
     *
25
     * @return CreditResponse
26
     * @throws GuzzleException
27
     * @throws HttpException
28
     * @throws JsonException
29
     */
30
    public function getCredit(): CreditResponse {
31
        $response = $this->smsir->get('/v1/credit');
32
        return new CreditResponse($response);
33
    }
34
35
    /**
36
     * get account line numbers
37
     *
38
     * @return LineResponse
39
     * @throws HttpException
40
     * @throws GuzzleException
41
     * @throws JsonException
42
     */
43
    public function getLines(): LineResponse {
44
        $response = $this->smsir->get('/v1/line');
45
        return new LineResponse($response);
46
    }
47
48
}
49