Skip to content

Commit e9f2b6e

Browse files
author
benemohamed
authored
Update IPFinder.php
1 parent 050dad0 commit e9f2b6e

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/Services/IPFinder.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
<?php
2+
23
namespace Torann\GeoIP\Services;
4+
35
use Exception;
46
use Illuminate\Support\Arr;
57
use Torann\GeoIP\Support\HttpClient;
8+
69
/**
710
* Class GeoIP
811
* @package Torann\GeoIP\Services
@@ -15,6 +18,7 @@ class IPFinder extends AbstractService
1518
* @var HttpClient
1619
*/
1720
protected $client;
21+
1822
/**
1923
* The "booting" method of the service.
2024
*
@@ -32,6 +36,7 @@ public function boot()
3236
],
3337
]);
3438
}
39+
3540
/**
3641
* {@inheritdoc}
3742
* @throws Exception
@@ -40,11 +45,14 @@ public function locate($ip)
4045
{
4146
// Get data from client
4247
$data = $this->client->get($ip);
48+
4349
// Verify server response
4450
if ($this->client->getErrors() !== null || empty($data[0])) {
4551
throw new Exception('Request failed (' . $this->client->getErrors() . ')');
4652
}
53+
4754
$json = json_decode($data[0], true);
55+
4856
return $this->hydrate($json);
4957
}
50-
}
58+
}

0 commit comments

Comments
 (0)