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.
Passed
Push — master ( ba89cf...799599 )
by Oleg
02:27
created

Geocoding::reverseGeocoding()   A

Complexity

Conditions 4
Paths 8

Size

Total Lines 16

Duplication

Lines 16
Ratio 100 %

Importance

Changes 0
Metric Value
cc 4
nc 8
nop 1
dl 16
loc 16
rs 9.7333
c 0
b 0
f 0
1
<?php
2
namespace Route4Me;
3
4
use Route4Me\Common;
5
use Route4Me\Enum\Endpoint;
6
7
class Geocoding extends Common
8
{
9
    public $strExportFormat;
10
    public $format;
11
    public $addresses;
12
    public $pk;
13
    public $offset;
14
    public $limit;
15
    public $housenumber;
16
    public $zipcode;
17
    
18
    public static function fromArray(array $params) 
19
    {
20
        $geocoding = new Geocoding();
21
        
22
        foreach($params as $key => $value) {
23
            if (property_exists($geocoding, $key)) {
24
                $geocoding->{$key} = $value;
25
            }
26
        }
27
        
28
        return $geocoding;
29
    }
30
    
31 View Code Duplication
    public static function forwardGeocoding($params)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in 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...
32
    {
33
        $body = array(
34
                'strExportFormat'    => isset($params['strExportFormat']) ? $params['strExportFormat']: null,
35
                'addresses' => isset($params['addresses']) ? $params['addresses'] : null,
36
            );
37
38
        $fgCoding = Route4Me::makeRequst(array(
39
            'url'    => Endpoint::GEOCODER,
40
            'method' => 'POST',
41
            'body'   => $body,
42
            'HTTPHEADER'  => 'Content-Type: multipart/form-data'
43
        ));
44
        
45
        return $fgCoding;
46
    }
47
    
48 View Code Duplication
    public static function reverseGeocoding($params)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in 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...
49
    {
50
        $query = array(
51
                'format' => isset($params['format']) ? $params['format']: null,
52
                'addresses' => isset($params['addresses']) ? $params['addresses'] : null,
53
                'detailed' => isset($params['detailed']) ? $params['detailed'] : null,
54
            );
55
56
        $fgcoding = Route4Me::makeRequst(array(
57
            'url'    => Endpoint::GEOCODER,
58
            'method' => 'POST',
59
            'query'  => $query
60
        ));
61
        
62
        return $fgcoding;
63
    }
64
    
65 View Code Duplication
    public static function getStreetData($params)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in 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...
66
    {
67
        $url_query = Endpoint::STREET_DATA;
68
        
69
        if (isset($params['pk'])) {
70
            $url_query.=$params['pk'].'/';
71
        }
72
        
73
        if (isset($params['offset'])) {
74
            $url_query.=$params['offset'].'/';
75
        }
76
        
77
        if (isset($params['limit'])) {
78
            $url_query.=$params['limit'].'/';
79
        }
80
81
        $query = array();
82
        
83
        $response = Route4Me::makeUrlRequst($url_query, array(
84
            'method' => 'GET',
85
            'query'  => $query
86
        ));
87
        
88
        return $response;
89
    }
90
    
91 View Code Duplication
    public static function getZipCode($params)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in 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...
92
    {
93
        $url_query = Endpoint::STREET_DATA_ZIPCODE;
94
        
95
        if (isset($params['zipcode'])) {
96
            $url_query.=$params['zipcode'].'/';
97
        }
98
        
99
        if (isset($params['offset'])) {
100
            $url_query.=$params['offset'].'/';
101
        }
102
        
103
        if (isset($params['limit'])) {
104
            $url_query.=$params['limit'].'/';
105
        }
106
107
        $query = array();
108
        
109
        $response = Route4Me::makeUrlRequst($url_query, array(
110
            'method' => 'GET',
111
            'query'  => $query
112
        ));
113
        
114
        return $response;
115
    }
116
    
117
    public static function getService($params)
118
    {
119
        $url_query = Endpoint::STREET_DATA_SERVICE;
120
        
121
        if (isset($params['zipcode'])) {
122
            $url_query.=$params['zipcode'].'/';
123
        }
124
        
125
        if (isset($params['housenumber'])) {
126
            $url_query.=$params['housenumber'].'/';
127
        }
128
        
129
        if (isset($params['offset'])) {
130
            $url_query.=$params['offset'].'/';
131
        }
132
        
133
        if (isset($params['limit'])) {
134
            $url_query.=$params['limit'].'/';
135
        }
136
137
        $query = array();
138
        
139
        $response = Route4Me::makeUrlRequst($url_query, array(
140
            'method' => 'GET',
141
            'query'  => $query
142
        ));
143
        
144
        return $response;
145
    }
146
}
147