1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace DominionEnterprises\NetAcuity\Databases; |
4
|
|
|
|
5
|
|
|
use GuzzleHttp\ClientInterface; |
6
|
|
|
|
7
|
|
|
/** |
8
|
|
|
* Formats and returns our expected data set according to the Net Acuity Edge type database. |
9
|
|
|
*/ |
10
|
|
View Code Duplication |
final class EdgeDatabase extends AbstractNetAcuityDatabase |
|
|
|
|
11
|
|
|
{ |
12
|
|
|
/** |
13
|
|
|
* EdgeDatabase constructor. |
14
|
|
|
* |
15
|
|
|
* @param ClientInterface $client The injected GuzzleHttp Client. |
16
|
|
|
* @param string $apiUserToken The Net Acuity API User Token. |
17
|
|
|
*/ |
18
|
|
|
public function __construct(ClientInterface $client, string $apiUserToken) |
19
|
|
|
{ |
20
|
|
|
parent::__construct($client, $apiUserToken); |
21
|
|
|
|
22
|
|
|
$this->_databaseIdentifier = 4; |
23
|
|
|
|
24
|
|
|
$this->_translations = [ |
25
|
|
|
'area-code' => 'edge-area-codes', |
26
|
|
|
'city' => 'edge-city', |
27
|
|
|
'city-code' => 'edge-city-code', |
28
|
|
|
'city-conf' => 'edge-city-conf', |
29
|
|
|
'conn-speed' => 'edge-conn-speed', |
30
|
|
|
'continent-code' => 'edge-continent-code', |
31
|
|
|
'country' => 'edge-country', |
32
|
|
|
'country-code' => 'edge-country-code', |
33
|
|
|
'country-conf' => 'edge-country-conf', |
34
|
|
|
'county' => 'edge-county', |
35
|
|
|
'gmt-offset' => 'edge-gmt-offset', |
36
|
|
|
'in-dist' => 'edge-in-dst', |
37
|
|
|
'ip' => 'ip', |
38
|
|
|
'latitude' => 'edge-latitude', |
39
|
|
|
'longitude' => 'edge-longitude', |
40
|
|
|
'metro-code' => 'edge-metro-code', |
41
|
|
|
'postal-conf' => 'edge-postal-conf', |
42
|
|
|
'region' => 'edge-region', |
43
|
|
|
'region-code' => 'edge-region-code', |
44
|
|
|
'region-conf' => 'edge-region-conf', |
45
|
|
|
'timezone-name' => 'edge-timezone-name', |
46
|
|
|
'transaction-id' => 'trans-id', |
47
|
|
|
'two-letter-country' => 'edge-two-letter-country', |
48
|
|
|
'zip-code' => 'edge-postal-code', |
49
|
|
|
]; |
50
|
|
|
} |
51
|
|
|
} |
52
|
|
|
|
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.