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

ReportForm   A

Complexity

Total Complexity 9

Size/Duplication

Total Lines 60
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 9
lcom 1
cbo 1
dl 0
loc 60
ccs 0
cts 27
cp 0
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 8 2
B getUrl() 0 25 4
A getBibFond() 0 4 1
A getEBooks() 0 4 1
A getSpecPo() 0 4 1
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
}