Completed
Push — master ( 2d8bdd...db0246 )
by Denis
02:03
created

ReportForm::getSecretKey()   A

Complexity

Conditions 4
Paths 3

Size

Total Lines 12
Code Lines 6

Duplication

Lines 12
Ratio 100 %

Code Coverage

Tests 0
CRAP Score 20

Importance

Changes 0
Metric Value
dl 12
loc 12
ccs 0
cts 6
cp 0
rs 9.2
c 0
b 0
f 0
cc 4
eloc 6
nc 3
nop 1
crap 20
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: dp
5
 * Date: 16.08.17
6
 * Time: 13:09
7
 */
8
9
namespace Lan\Ebs\Sdk;
10
11
use Exception;
12
13
final class ReportForm implements Common
14
{
15
    private $client;
16
17
    /**
18
     * Security constructor.
19
     *
20
     * @param  Client $client
21
     * @throws Exception
22
     */
23
    public function __construct(Client $client)
24
    {
25
        if (!$client) {
26
            throw new Exception('Client not defined');
27
        }
28
29
        $this->client = $client;
30
    }
31
32
    public function getUrl($method, array $params = [])
33
    {
34
        switch ($method) {
35
            case 'getBibFond':
36
                return [
37
                    'url' => '/1.0/report/form/bibFond',
38
                    'method' => 'GET',
39
                    'code' => 200
40
                ];
41
            case 'getEBooks':
42
                return [
43
                    'url' => '/1.0/report/form/eBooks',
44
                    'method' => 'GET',
45
                    'code' => 200
46
                ];
47
            case 'getSpecPo':
48
                return [
49
                    'url' => '/1.0/report/form/specPo',
50
                    'method' => 'GET',
51
                    'code' => 200
52
                ];
53
            default:
54
                throw new Exception('Route for ' . $method . ' not found');
55
        }
56
    }
57
58
    public function getBibFond()
59
    {
60
        return $this->client->getResponse($this->getUrl(__FUNCTION__))['data'];
61
    }
62
63
    public function getEBooks()
64
    {
65
        return $this->client->getResponse($this->getUrl(__FUNCTION__))['data'];
66
    }
67
68
    public function getSpecPo()
69
    {
70
        return $this->client->getResponse($this->getUrl(__FUNCTION__))['data'];
71
    }
72
}