Skip to content

Commit

Permalink
Update dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
webeweb committed Feb 21, 2023
1 parent deaa713 commit 3e4cdc3
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 14 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"ext-json": "*",
"guzzlehttp/guzzle": "^6.0|^7.0",
"psr/log": "^1.0",
"webeweb/core-library": "^8.0"
"webeweb/core-library": "^8.69"
},
"require-dev": {
"phpunit/phpunit": "^7.0|^9.0"
Expand Down
9 changes: 4 additions & 5 deletions src/Provider/AbstractProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public function __construct(string $apiToken = null, LoggerInterface $logger = n
}

/**
* Build the configuration.
* Builds the configuration.
*
* @return array Returns the configuration.
*/
Expand All @@ -74,7 +74,7 @@ private function buildConfiguration(): array {
}

/**
* Call the API.
* Calls the API.
*
* @param AbstractRequest $request The request.
* @param array $queryData The query data.
Expand All @@ -87,19 +87,18 @@ private function buildConfiguration(): array {
protected function callApi(AbstractRequest $request, array $queryData, bool $apiToken = true): string {

if (true === $apiToken && null === $this->getApiToken()) {
throw new InvalidArgumentException('The mandatory parameter "api_token" is missing');
throw $this->newMandatoryParameterException("api_token");
}

$query = true === $apiToken ? ["api_token" => $this->getApiToken()] : [];

try {

$config = $this->buildConfiguration();

$client = new Client($config);

$method = "GET";
$uri = substr($request->getResourcePath(), 1);
$uri = substr($this->buildResourcePath($request), 1);
$options = [
"query" => array_merge($query, $queryData),
];
Expand Down
10 changes: 2 additions & 8 deletions src/Request/AbstractRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
namespace WBW\Library\Pappers\Request;

use WBW\Library\Pappers\Response\AbstractResponse;
use WBW\Library\Provider\Request\AbstractRequest as BaseRequest;

/**
* Abstract request.
Expand All @@ -20,7 +21,7 @@
* @package WBW\Library\Pappers\Request
* @abstract
*/
abstract class AbstractRequest {
abstract class AbstractRequest extends BaseRequest {

/**
* Constructor.
Expand All @@ -37,13 +38,6 @@ public function __construct() {
*/
abstract public function deserializeResponse(string $rawResponse): AbstractResponse;

/**
* Get the resource path.
*
* @return string Returns the resource path.
*/
abstract public function getResourcePath(): string;

/**
* Serializes the request.
*
Expand Down

0 comments on commit 3e4cdc3

Please sign in to comment.