Completed
Push — master ( 4ed813...32abb8 )
by Sergey
04:41 queued 02:10
created

JSONRequest::getSource()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
3
namespace seregazhuk\SmsIntel\Requests;
4
5
class JSONRequest extends Request
6
{
7
    const BASE_URL = 'https://lcab.smsintel.ru/lcabApi/';
8
9
    /**
10
     * @return array
11
     */
12
    public static function getAllowedMethods() {
13
        return [
14
            'getSource',
15
        ];
16
    }
17
18
    /**
19
     * @param string $source
20
     * @return array|null
21
     */
22
    public function getSource($source)
23
    {
24
        return $this->exec('requestSource', ['source' => $source]);
25
    }
26
27
    /**
28
     * @param string $action
29
     * @return string
30
     */
31
    protected function makeEndPoint($action)
32
    {
33
        return self::BASE_URL . $action . '.php';
34
    }
35
36
    /**
37
     * @param array $requestBody
38
     * @return mixed
39
     */
40
    protected function formatRequestBody(array $requestBody)
41
    {
42
        return $requestBody;
43
    }
44
45
    /**
46
     * @param string $response
47
     * @return array
48
     */
49
    protected function parseResponse($response)
50
    {
51
        return json_decode($response, true);
52
    }
53
}