Completed
Pull Request — master (#9)
by Lars
02:42
created

RegistrationRepository   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A addRegistration() 0 7 2
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 string $request  Request object
31
     */
32 2
    public function __construct($request)
33
    {
34 2
        $this->request = $request;
0 ignored issues
show
Bug introduced by
The property request 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 2
    }
36
37
    /**
38
     * Adds registration
39
     *
40
     * @param array $registration Array with registration options
41
     *
42
     * @return void
43
     */
44 2
    public function addRegistration(array $registration)
45
    {
46 2
        $reg = $this->request->getRequest()->addChild('Tilmelding');
47 2
        foreach ($registration as $key => $value) {
48 2
            $reg->addChild($key, $value);
49 2
        }
50 2
    }
51
}
52