Passed
Push — master ( 3ee5c1...809568 )
by
unknown
05:05
created

HasChamber   A

Complexity

Total Complexity 10

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 23
c 1
b 0
f 0
dl 0
loc 28
rs 10
wmc 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A displayChamber() 0 12 5
A officialUrl() 0 12 5
1
<?php
2
3
namespace MySociety\TheyWorkForYou\DataClass\Regmem;
4
5
trait HasChamber {
6
    public function officialUrl(): string {
7
        switch ($this->chamber) {
8
            case 'house-of-commons':
9
                return "https://www.parliament.uk/mps-lords-and-offices/standards-and-financial-interests/parliamentary-commissioner-for-standards/registers-of-interests/register-of-members-financial-interests/";
10
            case 'scottish-parliament':
11
                return "https://www.parliament.scot/msps/register-of-interests";
12
            case 'northern-ireland-assembly':
13
                return "https://www.niassembly.gov.uk/your-mlas/register-of-interests/";
14
            case 'senedd':
15
                return "https://senedd.wales/senedd-business/register-of-members-interests/";
16
            default:
17
                return '';
18
        }
19
    }
20
21
    public function displayChamber(): string {
22
        switch ($this->chamber) {
23
            case 'house-of-commons':
24
                return 'House of Commons';
25
            case 'welsh-parliament':
26
                return 'Senedd';
27
            case 'scottish-parliament':
28
                return 'Scottish Parliament';
29
            case 'northern-ireland-assembly':
30
                return 'Northern Ireland Assembly';
31
            default:
32
                return 'Unknown Chamber';
33
        }
34
    }
35
36
}
37