Skip to content

Commit

Permalink
Merge pull request #3 from c-wolfe/development
Browse files Browse the repository at this point in the history
shit
  • Loading branch information
c-wolfe committed Apr 3, 2020
2 parents f72a0b0 + a09bd50 commit cf31e77
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions src/IPHub.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public function getIpInformation($ip) {
}

if ($this->existsInCache($ip)) {
return json_decode($this->predis->get("$this->prefix:$ip"), true);
return json_decode($this->predis->get("$this->prefix:$ip"));
} else {

$ch = curl_init();
Expand Down Expand Up @@ -141,8 +141,8 @@ public function getIpLevel($ip) {
*/
public function getLevel($ip) {
$information = $this->getIpInformation($ip);
if (is_array($information) && isset($information['block'])) {
return $information['block'];
if (is_array($information) && isset($information->block)) {
return $information->block;
}
return 0;
}
Expand All @@ -154,8 +154,8 @@ public function getLevel($ip) {
*/
public function getCountryCode($ip) {
$information = $this->getIpInformation($ip);
if (is_array($information) && isset($information['countryCode'])) {
return $information['countryCode'];
if (is_array($information) && isset($information->countryCode)) {
return $information->countryCode;
}
return 0;
}
Expand All @@ -167,8 +167,8 @@ public function getCountryCode($ip) {
*/
public function getCountryName($ip) {
$information = $this->getIpInformation($ip);
if (is_array($information) && isset($information['countryName'])) {
return $information['countryName'];
if (is_array($information) && isset($information->countryName)) {
return $information->countryName;
}
return 0;
}
Expand All @@ -180,8 +180,8 @@ public function getCountryName($ip) {
*/
public function getASN($ip) {
$information = $this->getIpInformation($ip);
if (is_array($information) && isset($information['asn'])) {
return $information['asn'];
if (is_array($information) && isset($information->asn)) {
return $information->asn;
}
return 0;
}
Expand All @@ -193,8 +193,8 @@ public function getASN($ip) {
*/
public function getISP($ip) {
$information = $this->getIpInformation($ip);
if (is_array($information) && isset($information['isp'])) {
return $information['isp'];
if (is_array($information) && isset($information->isp)) {
return $information->isp;
}
return 0;
}
Expand All @@ -206,8 +206,8 @@ public function getISP($ip) {
*/
public function getHostname($ip) {
$information = $this->getIpInformation($ip);
if (is_array($information) && isset($information['hostname'])) {
return $information['hostname'];
if (is_array($information) && isset($information->hostname)) {
return $information->hostname;
}
return 0;
}
Expand Down

0 comments on commit cf31e77

Please sign in to comment.