Skip to content

Commit ef67793

Browse files
committed
update
1 parent e403cff commit ef67793

File tree

6 files changed

+13
-12
lines changed

6 files changed

+13
-12
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ IPIP.net officially supported IP database ipdb format parsing library
33

44
# Installing
55
<pre>
6-
composer install ipip/db
6+
composer require ipip/db
77
</pre>
88

99
# Example Code

src/ipip/db/BaseStation.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
* @desc Parse IP library in ipdb format
66
* @copyright IPIP.net
77
*/
8+
89
namespace ipip\db;
910

1011
class BaseStation
@@ -29,7 +30,7 @@ public function findMap($ip, $language)
2930
public function findInfo($ip, $language)
3031
{
3132
$map = $this->findMap($ip, $language);
32-
if (NULL == $map)
33+
if (NULL === $map)
3334
{
3435
return NULL;
3536
}

src/ipip/db/City.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public function findMap($ip, $language)
3030
public function findInfo($ip, $language)
3131
{
3232
$map = $this->findMap($ip, $language);
33-
if (NULL == $map)
33+
if (NULL === $map)
3434
{
3535
return NULL;
3636
}

src/ipip/db/District.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public function findMap($ip, $language)
3030
public function findInfo($ip, $language)
3131
{
3232
$map = $this->findMap($ip, $language);
33-
if (NULL == $map)
33+
if (NULL === $map)
3434
{
3535
return NULL;
3636
}

src/ipip/db/IDC.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public function findMap($ip, $language)
3030
public function findInfo($ip, $language)
3131
{
3232
$map = $this->findMap($ip, $language);
33-
if (NULL == $map)
33+
if (NULL === $map)
3434
{
3535
return NULL;
3636
}

src/ipip/db/Reader.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ private function init()
5656

5757
$this->meta = json_decode($text, 1);
5858

59-
if (!isset($this->meta['fields']) || !isset($this->meta['languages']))
59+
if (isset($this->meta['fields']) === FALSE || isset($this->meta['languages']) === FALSE)
6060
{
6161
throw new \Exception('IP Database metadata error.');
6262
}
@@ -80,12 +80,12 @@ public function find($ip, $language)
8080
{
8181
if (is_resource($this->file) === FALSE)
8282
{
83-
throw new \BadMethodCallException('closed IPIP DB.');
83+
throw new \BadMethodCallException('IPIP DB closed.');
8484
}
8585

86-
if (!isset($this->meta['languages'][$language]))
86+
if (isset($this->meta['languages'][$language]) === FALSE)
8787
{
88-
throw new \InvalidArgumentException("language : {$language} not support");
88+
throw new \InvalidArgumentException("language : {$language} not support.");
8989
}
9090

9191
if (filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4 | FILTER_FLAG_IPV6) === FALSE)
@@ -125,7 +125,7 @@ public function find($ip, $language)
125125
public function findMap($ip, $language)
126126
{
127127
$array = $this->find($ip, $language);
128-
if (NULL == $array)
128+
if (NULL === $array)
129129
{
130130
return NULL;
131131
}
@@ -208,7 +208,7 @@ private function findNode($ip)
208208
return $node;
209209
}
210210

211-
throw new \Exception("find node failed");
211+
throw new \Exception("find node failed.");
212212
}
213213

214214
/**
@@ -271,7 +271,7 @@ private function read($stream, $offset, $length)
271271
}
272272
}
273273

274-
throw new \Exception("The Database file read bad data");
274+
throw new \Exception("The Database file read bad data.");
275275
}
276276

277277
return '';

0 commit comments

Comments
 (0)