Test Failed
Branch master (fd8df9)
by Julien
02:26
created

Lists   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 60
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getList() 0 13 2
B getFields() 0 23 4
1
<?php
2
3
namespace EncreInformatique\DoctorSenderApi\Endpoints;
4
5
class Lists extends Endpoint
6
{
7
    /*
8
     * SoapClient $client
9
     */
10
    private $client;
11
12
    public function __construct($client)
13
    {
14
        $this->client = $client;
15
    }
16
17
    /**
18
     * We get the List of Users.
19
     *
20
     * @param $options
21
     */
22
    public function getList($options)
23
    {
24
        if (isset($options['isTestList'])) {
25
            $isTestList = true;
26
        } else {
27
            $isTestList = false;
28
        }
29
30
        return $this->client->webservice(
31
            'dsUsersListGetAll',
32
            array($isTestList)
33
        );
34
    }
35
36
    /**
37
     * We get the list of Fields of a Users List.
38
     *
39
     * @param $options
40
     */
41
    public function getFields($options)
42
    {
43
        if (!isset($options['name'])) {
44
            return ['error' => true, 'msg' => 'no name of list was provided'];
45
        }
46
        $listName = $options['name'];
47
48
        if (isset($options['isTestList'])) {
49
            $isTestList = true;
50
        } else {
51
            $isTestList = false;
52
        }
53
        if (isset($options['getType'])) {
54
            $getType = true;
55
        } else {
56
            $getType = false;
57
        }
58
59
        return $this->client->webservice(
60
            'dsUsersListGetFields',
61
            array($listName, $isTestList, $getType)
62
        );
63
    }
64
}
65