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

Response   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 53
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 7
lcom 1
cbo 0
dl 0
loc 53
ccs 0
cts 15
cp 0
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getBody() 0 12 4
A isOk() 0 4 1
A getCount() 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
use EDBBrugs\ResponseInterface;
17
18
/**
19
 * Service Communicator with EDB-Brugs
20
 *
21
 * @category EDBBrugs
22
 * @package  EDBBrugs
23
 * @author   Lars Olesen <[email protected]>
24
 * @license  MIT Open Source License https://opensource.org/licenses/MIT
25
 * @version  GIT: <git_id>
26
 */
27
class Response implements ResponseInterface
28
{
29
    protected $response;
30
31
    /**
32
     * Constructor
33
     *
34
     * @param object $response Actual response from SOAP
35
     */
36
    public function __construct($response)
37
    {
38
        $this->response = $response;
39
    }
40
41
    /**
42
     * Gets the body from the response
43
     *
44
     * @return mixed SOAP Response
45
     * @throws \Exception
46
     */
47
    public function getBody()
48
    {
49
        if (!empty($this->response->HentBehandledeTilmeldingerV2Result)) {
50
            return $this->response->HentBehandledeTilmeldingerV2Result;
51
        } elseif (!empty($this->response->HentNyeTilmeldingerV2Result)) {
52
            return $this->response->HentNyeTilmeldingerV2Result;
53
        } elseif (!empty($this->response->NyTilmelding2Result)) {
54
            return $this->response->NyTilmelding2Result;
55
        }
56
57
        throw new \Exception('Not a known response type - You should write a Response class');
58
    }
59
60
    /**
61
     * Checks whether the communication is OK
62
     *
63
     * @return boolean
64
     */
65
    public function isOk()
66
    {
67
        return true;
68
    }
69
70
    /**
71
     * Count how many results are being returned
72
     *
73
     * @return int
74
     */
75
    public function getCount()
76
    {
77
        return 1;
78
    }
79
}
80