diff --git a/README.md b/README.md index 1fdb946..cf83dcc 100644 --- a/README.md +++ b/README.md @@ -314,7 +314,7 @@ If you are using PHP 5.3 with an autoloader besides Composer, you must load ## Contributing ## Patches and pull requests are encouraged. All code should follow the -PSR-2 style guidelines. Please include unit tests whenever possible. You may obtain the test data for the maxmind-db folder from https://github.com/maxmind/MaxMind-DB +PSR-2 style guidelines. Please include unit tests whenever possible. You may obtain the test data for the maxmind-db folder by running `git submodule update --init --recursive` or adding `--recursive` to your initial clone, or from https://github.com/maxmind/MaxMind-DB ## Versioning ## diff --git a/src/GeoIp2/Model/AbstractModel.php b/src/GeoIp2/Model/AbstractModel.php index b6c7533..1bdabc2 100644 --- a/src/GeoIp2/Model/AbstractModel.php +++ b/src/GeoIp2/Model/AbstractModel.php @@ -2,7 +2,6 @@ namespace GeoIp2\Model; - /** * @ignore */ diff --git a/src/GeoIp2/WebService/Client.php b/src/GeoIp2/WebService/Client.php index 6f04bee..30f9b1b 100644 --- a/src/GeoIp2/WebService/Client.php +++ b/src/GeoIp2/WebService/Client.php @@ -64,8 +64,8 @@ class Client implements ProviderInterface * @param string $host Optional host parameter * @param object $guzzleClient Optional Guzzle client to use (to facilitate * unit testing). - * @param string $timeout Total transaction timeout - * @param string $connectTimeout Initial connection timeout + * @param string $timeout Total transaction timeout in seconds + * @param string $connectTimeout Initial connection timeout in seconds */ public function __construct( $userId, @@ -189,10 +189,10 @@ class Client implements ProviderInterface $client = $this->guzzleClient ? $this->guzzleClient : new GuzzleClient(); $options = array(); - if($this->timeout != null){ + if ($this->timeout !== null) { $options['timeout'] = $this->timeout; } - if($this->connectTimeout != null){ + if ($this->connectTimeout !== null) { $options['connect_timeout'] = $this->connectTimeout; } $request = $client->get($uri, array('Accept' => 'application/json'), $options); diff --git a/tests/GeoIp2/Test/WebService/ClientTest.php b/tests/GeoIp2/Test/WebService/ClientTest.php index 558272e..884e3a6 100644 --- a/tests/GeoIp2/Test/WebService/ClientTest.php +++ b/tests/GeoIp2/Test/WebService/ClientTest.php @@ -451,15 +451,17 @@ class ClientTest extends \PHPUnit_Framework_TestCase 'request sets Accept header to GeoIP2 PHP API (Guzzle%s)' ); + $curlOptions = $request->getCurlOptions(); + $this->assertEquals( '27000', - $request->getCurlOptions()[CURLOPT_TIMEOUT_MS], + $curlOptions[CURLOPT_TIMEOUT_MS], 'request sets Curl Option Timeout to 27 seconds' ); $this->assertEquals( '72000', - $request->getCurlOptions()[CURLOPT_CONNECTTIMEOUT_MS], + $curlOptions[CURLOPT_CONNECTTIMEOUT_MS], 'request sets Curl Option Connect Timeout to 72 seconds' ); }