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 — develop ( a2e4fd...2509d0 )
by Samuel
05:31
created

GetNearestPostOffice   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 90.91%

Importance

Changes 7
Bugs 1 Features 1
Metric Value
wmc 6
c 7
b 1
f 1
lcom 1
cbo 2
dl 0
loc 38
ccs 20
cts 22
cp 0.9091
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A buildRequest() 0 6 1
B getUri() 0 25 5
1
<?php
2
namespace LinusShops\CanadaPost\Services;
3
use GuzzleHttp\Client;
4
use GuzzleHttp\Psr7\Request;
5
use LinusShops\CanadaPost\Service;
6
/**
7
 * Get the nearest post office
8
 *
9
 * @see https://www.canadapost.ca/cpo/mc/business/productsservices/developers/services/findpostoffice/nearestpostoffice.jsf
10
 * @author Sam Schmidt <[email protected]>
11
 * @since 2015-12-09
12
 * @company Linus Shops
13
 */
14
15
class GetNearestPostOffice extends Service
16
{
17 3
    private function getUri()
18
    {
19 3
        $uri = "/rs/postoffice?";
20 3
        if ($this->hasParameter('d2po')) {
21 3
            $uri .= "d2po={$this->getParameter('d2po')}&";
22 3
        }
23
24 3
        if ($this->hasParameter('tonight')) {
25
            $uri .= "tonight={$this->getParameter('tonight')}&";
26
        }
27
28 3
        $uri .= "maximum={$this->getParameter('maximum', 10)}&";
29
30 3
        if ($this->hasParameter('longitude') && $this->hasParameter('latitude')) {
31 2
            $uri .= "longitude={$this->getParameter('longitude')}&";
32 2
            $uri .= "latitude={$this->getParameter('latitude')}&";
33 2
        } else {
34 1
            $uri .= "postalCode={$this->getParameter('postalCode')}&";
35 1
            $uri .= "province={$this->getParameter('province')}&";
36 1
            $uri .= "city={$this->getParameter('city')}&";
37 1
            $uri .= "streetName={$this->getParameter('streetName')}&";
38
        }
39
40 3
        return $uri;
41
    }
42
43
    /**
44
     * @return Request
45
     */
46 3
    protected function buildRequest()
47
    {
48 3
        $request = new Request('GET', $this->getUri());
49 3
        $this->setHeader('Accept', 'application/vnd.cpc.postoffice+xml ');
50 3
        return $request;
51
    }
52
}
53