1 | <?php |
||
2 | |||
3 | // +---------------------------------------------------------------------- |
||
4 | // | ThinkLibrary 6.0 for ThinkPhP 6.0 |
||
5 | // +---------------------------------------------------------------------- |
||
6 | // | 版权所有 2017~2020 [ https://www.dtapp.net ] |
||
7 | // +---------------------------------------------------------------------- |
||
8 | // | 官方网站: https://gitee.com/liguangchun/ThinkLibrary |
||
9 | // +---------------------------------------------------------------------- |
||
10 | // | 开源协议 ( https://mit-license.org ) |
||
11 | // +---------------------------------------------------------------------- |
||
12 | // | gitee 仓库地址 :https://gitee.com/liguangchun/ThinkLibrary |
||
13 | // | github 仓库地址 :https://github.com/GC0202/ThinkLibrary |
||
14 | // | Packagist 地址 :https://packagist.org/packages/liguangchun/think-library |
||
15 | // +---------------------------------------------------------------------- |
||
16 | |||
17 | namespace DtApp\ThinkLibrary\service\Ip; |
||
18 | |||
19 | use DtApp\ThinkLibrary\Service; |
||
20 | use Exception; |
||
21 | use think\App; |
||
22 | |||
23 | /** |
||
24 | * IP - IPIP |
||
25 | * Class IpIpService |
||
26 | * @package DtApp\ThinkLibrary\service\ip |
||
27 | */ |
||
28 | class IpIpService extends Service |
||
29 | { |
||
30 | /** |
||
31 | * @var IpIpReader|null |
||
32 | */ |
||
33 | public $reader; |
||
34 | |||
35 | /** |
||
36 | * IpIpService constructor. |
||
37 | * @param App $app |
||
38 | * @throws Exception |
||
39 | */ |
||
40 | public function __construct(App $app) |
||
41 | { |
||
42 | $this->reader = new IpIpReader(__DIR__ . '../bin/ipipfree.ipdb'); |
||
43 | parent::__construct($app); |
||
44 | } |
||
45 | |||
46 | /** |
||
47 | * @param $ip |
||
48 | * @param $language |
||
49 | * @return array|NULL |
||
50 | */ |
||
51 | public function getFind(string $ip = '', string $language = 'CN') |
||
52 | { |
||
53 | if (empty($ip)) { |
||
54 | $ip = get_ip(); |
||
55 | } |
||
56 | return $this->reader->find($ip, $language); |
||
0 ignored issues
–
show
|
|||
57 | } |
||
58 | |||
59 | /** |
||
60 | * @param $ip |
||
61 | * @param $language |
||
62 | * @return array|false|null |
||
63 | */ |
||
64 | public function getFindMap(string $ip = '', string $language = 'CN') |
||
65 | { |
||
66 | if (empty($ip)) { |
||
67 | $ip = get_ip(); |
||
68 | } |
||
69 | return $this->reader->findMap($ip, $language); |
||
70 | } |
||
71 | |||
72 | /** |
||
73 | * @param $ip |
||
74 | * @param $language |
||
75 | * @return IpIpDistrictInfo|null |
||
76 | */ |
||
77 | public function getFindInfo(string $ip = '', string $language = 'CN') |
||
78 | { |
||
79 | if (empty($ip)) { |
||
80 | $ip = get_ip(); |
||
81 | } |
||
82 | $map = $this->getFindMap($ip, $language); |
||
83 | if (NULL === $map) { |
||
84 | return NUll; |
||
85 | } |
||
86 | return new IpIpDistrictInfo($map); |
||
87 | } |
||
88 | } |
||
89 |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.