Skip to content

Commit

Permalink
Fix return type of getApiUri() method
Browse files Browse the repository at this point in the history
Updated `getApiUri` to return `string` and added proper type hinting for `get` method parameters. Included handling for `GuzzleException` to ensure better error management during HTTP requests.
  • Loading branch information
minasm committed Oct 13, 2024
1 parent 5060a42 commit abe6382
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/Api/EodClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace RadicalLoop\Eod\Api;

use GuzzleHttp\Exception\GuzzleException;
use RadicalLoop\Eod\Config;
use GuzzleHttp\Client as GuzzleHttpClient;

Expand Down Expand Up @@ -45,21 +46,22 @@ public function __construct(Config $config)
/**
* get api uri
*
* @return void
* @return string
*/
public function getApiUri()
public function getApiUri(): string
{
return rtrim($this->config->getApiUrl(), '/') . $this->urlSegment;
}

/**
* send request for api
*
* @param string $symbol
* @param array $params
* @param string $symbol
* @param array $params
* @return string|json
* @throws GuzzleException
*/
public function get($symbol, $params = [])
public function get(string $symbol, array $params = [])
{
$segment = $symbol ? ('/' . $symbol) : '';
$httpQuery = http_build_query(array_merge($params, ['api_token' => $this->config->getApiToken()]));
Expand Down

0 comments on commit abe6382

Please sign in to comment.