Completed
Push — master ( 381bc0...2b9053 )
by Lars
05:55 queued 02:03
created

RegistrationRepository   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 55
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 45.45%

Importance

Changes 0
Metric Value
wmc 5
lcom 1
cbo 0
dl 0
loc 55
ccs 5
cts 11
cp 0.4545
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A addRegistrations() 0 4 1
A getNewRegistrations() 0 4 1
A getHandledRegistrations() 0 4 1
A delete() 0 4 1
1
<?php
2
/**
3
 * SDK to communicate with EDBBrugs
4
 *
5
 * PHP Version 5
6
 *
7
 * @category EDBBrugs
8
 * @package  EDBBrugs
9
 * @author   Lars Olesen <[email protected]>
10
 * @license  MIT Open Source License https://opensource.org/licenses/MIT
11
 * @version  GIT: <git_id>
12
 */
13
14
namespace EDBBrugs;
15
16
/**
17
 * Generate the XML
18
 *
19
 * @category EDBBrugs
20
 * @package  EDBBrugs
21
 * @author   Lars Olesen <[email protected]>
22
 * @license  MIT Open Source License https://opensource.org/licenses/MIT
23
 * @version  GIT: <git_id>
24
 */
25
class RegistrationRepository
26
{
27
    /**
28
     * Constructor
29
     *
30
     * @param ClientInterface $client Client object
31
     */
32 1
    public function __construct(ClientInterface $client)
33
    {
34 1
        $this->client = $client;
0 ignored issues
show
Bug introduced by
The property client does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
35 1
    }
36
37
    /**
38
     * Adds registration
39
     *
40
     * @param array $registrations Array with several registrations
41
     *
42
     * @return ResponseInterface
43
     */
44 1
    public function addRegistrations(array $registrations)
45
    {
46 1
        return $this->client->createNewRegistrations($registrations);
47
    }
48
49
    /**
50
     * Gets new registrations
51
     *
52
     * @return ResponseInterface
53
     */
54
    public function getNewRegistrations()
55
    {
56
        return $this->client->getNewRegistrations();
57
    }
58
59
    /**
60
     * Gets handled registrations
61
     *
62
     * @return ResponseInterface
63
     */
64
    public function getHandledRegistrations()
65
    {
66
        return $this->client->getHandledRegistrations();
67
    }
68
69
    /**
70
     * Deletes registration
71
     *
72
     * @throws Exception
73
     * @return void
74
     */
75
    public function delete()
76
    {
77
        throw new \Exception('It is not possible to delete registrations using the SOAP webservice');
78
    }
79
}
80