Skip to content

Commit 485c15d

Browse files
committed
update
1 parent c486fac commit 485c15d

File tree

8 files changed

+256
-0
lines changed

8 files changed

+256
-0
lines changed

src/ipip/db/BaseStation.php

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?php
2+
3+
namespace ipip\db;
4+
5+
class BaseStation
6+
{
7+
public $reader = NULL;
8+
9+
public function __construct($db)
10+
{
11+
$this->reader = new Reader($db);
12+
}
13+
14+
public function find($ip, $language)
15+
{
16+
return $this->reader->find($ip, $language);
17+
}
18+
19+
public function findMap($ip, $language)
20+
{
21+
return $this->reader->findMap($ip, $language);
22+
}
23+
24+
public function findInfo($ip, $language)
25+
{
26+
$map = $this->findMap($ip, $language);
27+
if (NULL == $map)
28+
{
29+
return NULL;
30+
}
31+
32+
return new BaseStationInfo($map);
33+
}
34+
}

src/ipip/db/BaseStationInfo.php

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?php
2+
3+
namespace ipip\db;
4+
5+
class BaseStationInfo
6+
{
7+
public $country_name = '';
8+
public $region_name = '';
9+
public $city_name = '';
10+
public $owner_domain = '';
11+
public $isp_domain = '';
12+
public $base_station = '';
13+
14+
public function __construct(array $data)
15+
{
16+
foreach ($data AS $field => $value)
17+
{
18+
$this->{$field} = $value;
19+
}
20+
}
21+
22+
public function __get($name)
23+
{
24+
return $this->{$name};
25+
}
26+
}

src/ipip/db/City.php

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?php
2+
3+
namespace ipip\db;
4+
5+
class City
6+
{
7+
public $reader = NULL;
8+
9+
public function __construct($db)
10+
{
11+
$this->reader = new Reader($db);
12+
}
13+
14+
public function find($ip, $language)
15+
{
16+
return $this->reader->find($ip, $language);
17+
}
18+
19+
public function findMap($ip, $language)
20+
{
21+
return $this->reader->findMap($ip, $language);
22+
}
23+
24+
public function findInfo($ip, $language)
25+
{
26+
$map = $this->findMap($ip, $language);
27+
if (NULL == $map)
28+
{
29+
return NULL;
30+
}
31+
32+
return new CityInfo($map);
33+
}
34+
}

src/ipip/db/CityInfo.php

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<?php
2+
3+
namespace ipip\db;
4+
5+
class CityInfo
6+
{
7+
public $country_name = '';
8+
public $region_name = '';
9+
public $city_name = '';
10+
public $owner_domain = '';
11+
public $isp_domain = '';
12+
public $latitude = '';
13+
public $longitude = '';
14+
public $timezone = '';
15+
public $utc_offset = '';
16+
public $china_admin_code = '';
17+
public $idd_code = '';
18+
public $country_code = '';
19+
public $continent_code = '';
20+
public $idc = '';
21+
public $base_station = '';
22+
public $country_code3 = '';
23+
public $european_union = '';
24+
public $currency_code = '';
25+
public $currency_name = '';
26+
public $anycast = '';
27+
28+
public function __construct(array $data)
29+
{
30+
foreach ($data AS $field => $value)
31+
{
32+
$this->{$field} = $value;
33+
}
34+
}
35+
36+
public function __get($name)
37+
{
38+
return $this->{$name};
39+
}
40+
}

src/ipip/db/District.php

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?php
2+
3+
namespace ipip\db;
4+
5+
class District
6+
{
7+
public $reader = NULL;
8+
9+
public function __construct($db)
10+
{
11+
$this->reader = new Reader($db);
12+
}
13+
14+
public function find($ip, $language)
15+
{
16+
return $this->reader->find($ip, $language);
17+
}
18+
19+
public function findMap($ip, $language)
20+
{
21+
return $this->reader->findMap($ip, $language);
22+
}
23+
24+
public function findInfo($ip, $language)
25+
{
26+
$map = $this->findMap($ip, $language);
27+
if (NULL == $map)
28+
{
29+
return NULL;
30+
}
31+
32+
return new DistrictInfo($map);
33+
}
34+
}

src/ipip/db/DistrictInfo.php

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?php
2+
3+
namespace ipip\db;
4+
5+
class DistrictInfo
6+
{
7+
public $country_name = '';
8+
public $region_name = '';
9+
public $city_name = '';
10+
public $district_name = '';
11+
public $china_admin_code = '';
12+
public $covering_radius = '';
13+
public $longitude = '';
14+
public $latitude = '';
15+
16+
public function __construct(array $data)
17+
{
18+
foreach ($data AS $field => $value)
19+
{
20+
$this->{$field} = $value;
21+
}
22+
}
23+
24+
public function __get($name)
25+
{
26+
return $this->{$name};
27+
}
28+
}

src/ipip/db/IDC.php

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?php
2+
3+
namespace ipip\db;
4+
5+
class IDC
6+
{
7+
public $reader = NULL;
8+
9+
public function __construct($db)
10+
{
11+
$this->reader = new Reader($db);
12+
}
13+
14+
public function find($ip, $language)
15+
{
16+
return $this->reader->find($ip, $language);
17+
}
18+
19+
public function findMap($ip, $language)
20+
{
21+
return $this->reader->findMap($ip, $language);
22+
}
23+
24+
public function findInfo($ip, $language)
25+
{
26+
$map = $this->findMap($ip, $language);
27+
if (NULL == $map)
28+
{
29+
return NULL;
30+
}
31+
32+
return new IDCInfo($map);
33+
}
34+
}

src/ipip/db/IDCInfo.php

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?php
2+
3+
namespace ipip\db;
4+
5+
class IDCInfo
6+
{
7+
public $country_name = '';
8+
public $region_name = '';
9+
public $city_name = '';
10+
public $owner_domain = '';
11+
public $isp_domain = '';
12+
public $idc = '';
13+
14+
public function __construct(array $data)
15+
{
16+
foreach ($data AS $field => $value)
17+
{
18+
$this->{$field} = $value;
19+
}
20+
}
21+
22+
public function __get($name)
23+
{
24+
return $this->{$name};
25+
}
26+
}

0 commit comments

Comments
 (0)