File tree Expand file tree Collapse file tree 8 files changed +256
-0
lines changed Expand file tree Collapse file tree 8 files changed +256
-0
lines changed Original file line number Diff line number Diff line change
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
+ }
Original file line number Diff line number Diff line change
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
+ }
Original file line number Diff line number Diff line change
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
+ }
Original file line number Diff line number Diff line change
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
+ }
Original file line number Diff line number Diff line change
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
+ }
Original file line number Diff line number Diff line change
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
+ }
Original file line number Diff line number Diff line change
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
+ }
Original file line number Diff line number Diff line change
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
+ }
You can’t perform that action at this time.
0 commit comments