GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( 95f711...5b62bb )
by Joost van
13s
created

ResponseParser::getProfession()   B

Complexity

Conditions 2
Paths 2

Size

Total Lines 37
Code Lines 32

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
c 2
b 0
f 0
dl 0
loc 37
rs 8.8571
cc 2
eloc 32
nc 2
nop 1

2 Methods

Rating   Name   Duplication   Size   Complexity  
A ResponseParser::getMention() 0 12 2
A ResponseParser::getLimitation() 0 15 2
1
<?php
2
/*
3
* (c) Waarneembemiddeling.nl
4
*
5
* For the full copyright and license information, please view the LICENSE
6
* file that was distributed with this source code.
7
*/
8
9
namespace Wb\BigRegister\SoapClient;
10
11
use Wb\BigRegister\ProfessionalGroup;
12
use Wb\BigRegister\SoapClient\Model\ListHcpApproxResponse4;
13
use Wb\BigRegister\Specialism;
14
15
class ResponseParser
16
{
17
    public function parse(ListHcpApproxResponse4 $response)
18
    {
19
        $ret = array();
20
        if (isset($response->ListHcpApprox->ListHcpApprox4)) {
21
            foreach ($response->ListHcpApprox->ListHcpApprox4 as $hcpResult) {
22
                $return = array();
23
                $return['name'] = $hcpResult->MailingName;
24
                $return['prefix'] = $hcpResult->Prefix;
25
                $return['initial'] = $hcpResult->Initial;
26
                $return['birthSurname'] = $hcpResult->BirthSurname;
27
                $return['gender'] = $hcpResult->Gender === 'M' ? 'Man' : 'Vrouw';
28
                $return['articles'] = array();
29
                $return['specialisms'] = array();
30
                $return['mentions'] = array();
31
                $return['judgements'] = array();
32
                $return['limitations'] = array();
33
                if (isset($hcpResult->ArticleRegistration->ArticleRegistrationExtApp)) {
34
                    foreach ($hcpResult->ArticleRegistration->ArticleRegistrationExtApp as $registration) {
35
                        $article = array();
36
                        $article['bigNumber'] = $registration->ArticleRegistrationNumber;
37
                        $article['start'] = new \DateTime($registration->ArticleRegistrationStartDate);
38
                        $article['end'] = null;
39
                        if ($registration->ArticleRegistrationEndDate !== '0001-01-01T00:00:00') {
40
                            $article['end'] = new \DateTime($registration->ArticleRegistrationEndDate);
41
                        }
42
                        $article['profession'] = ProfessionalGroup::nameOf($registration->ProfessionalGroupCode);
43
                        $article['professionCode'] = $registration->ProfessionalGroupCode;
44
45
                        $return['articles'][] = $article;
46
                    }
47
                }
48
49
                if (isset($hcpResult->Specialism->SpecialismExtApp1)) {
50
                    foreach ($hcpResult->Specialism->SpecialismExtApp1 as $row) {
51
                        $specialism = array();
52
                        $specialism['bigNumber'] = $row->ArticleRegistrationNumber;
53
                        $specialism['start'] = null;
54
                        if ($row->StartDate) {
55
                            $specialism['start'] = new \DateTime($row->StartDate);
56
                        }
57
                        $specialism['end'] = null;
58
                        if ($row->EndDate) {
59
                            $specialism['end'] = new \DateTime($row->EndDate);
60
                        }
61
                        $specialism['name'] = Specialism::nameOf($row->TypeOfSpecialismId);
62
                        $specialism['code'] = $row->TypeOfSpecialismId;
63
                        $return['specialisms'][] = $specialism;
64
                    }
65
                }
66 View Code Duplication
                if (isset($hcpResult->Mention->MentionExtApp)) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
67
                    foreach ($hcpResult->Mention->MentionExtApp as $row) {
68
                        $mention = array();
69
                        $mention['bigNumber'] = $row->ArticleRegistrationNumber;
70
                        $mention['start'] = new \DateTime($row->StartDate);
71
                        $mention['end'] = null;
72
                        if ($row->EndDate) {
73
                            $mention['end'] = new \DateTime($row->EndDate);
74
                        }
75
                        $mention['name'] = $this->getMention($row->TypeOfMentionId);
76
                        $return['mentions'][] = $mention;
77
                    }
78
                }
79 View Code Duplication
                if (isset($hcpResult->JudgmentProvision->JudgmentProvisionExtApp)) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
80
                    foreach ($hcpResult->JudgmentProvision->JudgmentProvisionExtApp as $row) {
81
                        $judgement = array();
82
                        $judgement['bigNumber'] = $row->ArticleNumber;
83
                        $judgement['start'] = new \DateTime($row->StartDate);
84
                        $judgement['end'] = null;
85
                        if ($row->EndDate) {
86
                            $judgement['end'] = new \DateTime($row->EndDate);
87
                        }
88
                        $judgement['description'] = $row->PublicDescription;
89
                        $return['judgements'][] = $judgement;
90
                    }
91
                }
92 View Code Duplication
                if (isset($hcpResult->Limitation->LimitationExtApp)) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
93
                    foreach ($hcpResult->Limitation->LimitationExtApp as $row) {
94
                        $limitation = array();
95
                        $limitation['bigNumber'] = $row->ArticleRegistrationNumber;
96
                        $limitation['start'] = new \DateTime($row->StartDate);
97
                        $limitation['end'] = null;
98
                        if ($row->EndDate) {
99
                            $limitation['end'] = new \DateTime($row->EndDate);
100
                        }
101
                        $limitation['name'] = $this->getLimitation($row->TypeLimitationId);
102
                        $limitation['description'] = $row->Description;
103
                        $return['limitations'][] = $limitation;
104
                    }
105
                }
106
107
                $ret[] = $return;
108
            }
109
        }
110
111
        return $ret;
112
    }
113
114
    protected function getMention($code)
115
    {
116
        $list = array(
117
            1 => 'Voorschrijfbevoegdheid Astma en COPD',
118
            2 => 'Voorschrijfbevoegdheid Diabetes Mellitus',
119
            3 => 'Voorschrijfbevoegdheid Oncologie'
120
        );
121
122
        if (isset($list[$code])) {
123
            return $list[$code];
124
        }
125
    }
126
127
    protected function getLimitation($code)
128
    {
129
        $list = array(
130
            1 => 'Ongeclausuleerde inschrijving',
131
            2 => 'Geclausuleerde inschrijving voor bepaalde tijd',
132
            3 => 'Geclausuleerde inschrijving voor waarneming (bepaalde tijd)',
133
            4 => 'Geclausuleerde inschrijving voor onbepaalde tijd',
134
            5 => 'Clausule (conversie uit REGBIG)',
135
            6 => 'Geclausuleerde inschrijving (conversie uit REGBIG)',
136
        );
137
138
        if (isset($list[$code])) {
139
            return $list[$code];
140
        }
141
    }
142
} 
143