Skip to content

Commit 5b20aa3

Browse files
authored
Merge pull request #19 from chadicus/master
Add and use NetAcuityInterface
2 parents df460f8 + e98c427 commit 5b20aa3

File tree

2 files changed

+45
-2
lines changed

2 files changed

+45
-2
lines changed

src/NetAcuity.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
/**
1010
* A client to access a NetAcuity server for geo-ip lookup.
1111
*/
12-
final class NetAcuity
12+
final class NetAcuity implements NetAcuityInterface
1313
{
1414
/**
1515
* @var NetAcuityDatabaseInterface The Net Acuity Database to fetch data from.
@@ -59,7 +59,7 @@ public function __construct(NetAcuityDatabaseInterface $database)
5959
* @type string $timezone-name
6060
* }
6161
*/
62-
public function getGeo(string $ip)
62+
public function getGeo(string $ip) : array
6363
{
6464
Util::throwIfNotType(['string' => $ip], true);
6565
return $this->database->fetch($ip);

src/NetAcuityInterface.php

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<?php
2+
3+
namespace TraderInteractive\NetAcuity;
4+
5+
/**
6+
* Contract for NetAcuity api client.
7+
*/
8+
interface NetAcuityInterface
9+
{
10+
/**
11+
* Gets the geo data for the given IP.
12+
*
13+
* Failures will be raised as exceptions.
14+
*
15+
* @param string $ip The ip address to lookup
16+
*
17+
* @return array {
18+
* @type string $country
19+
* @type string $region
20+
* @type string $city
21+
* @type string $conn-speed
22+
* @type string $metro-code
23+
* @type string $latitude
24+
* @type string $longitude
25+
* @type string $postal-code
26+
* @type string $country-code
27+
* @type string $region-code
28+
* @type string $city-code
29+
* @type string $continent-code
30+
* @type string $two-letter-country
31+
* @type string $internal-code
32+
* @type string $area-code
33+
* @type string $country-conf
34+
* @type string $region-conf
35+
* @type string $city-conf
36+
* @type string $postal-conf
37+
* @type string $gmt-offset
38+
* @type string $in-dist
39+
* @type string $timezone-name
40+
* }
41+
*/
42+
public function getGeo(string $ip) : array;
43+
}

0 commit comments

Comments
 (0)