Skip to content

Commit

Permalink
Merge pull request #125 from renderforest/fix-optional-parameter-issue
Browse files Browse the repository at this point in the history
fix-optional-parameter-issue
  • Loading branch information
narekhovhannisyan authored Feb 8, 2019
2 parents 26c81df + 495d76e commit 634da99
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 9 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "renderforest/sdk-php",
"description": "Renderforest SDK for PHP",
"version": "0.3.10",
"version": "0.3.11",
"homepage": "https://github.com/renderforest/renderforest-sdk-php",
"authors": [
{
Expand Down
11 changes: 4 additions & 7 deletions src/Params.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,19 +52,16 @@ public function destructURLParam($payload, $param)

/**
* Destructs optional URL param from the given payload.
* @param $payload - Thr array to destruct.
* @param $param - The param to destruct from array.
* @param array $payload - Thr array to destruct.
* @param string $param - The param to destruct from array.
* @return string
* @throws RenderforestError
*/
public function destructOptionalURLParam($payload, $param)
{
if (!isset($payload) || sizeof($payload)) {
throw new RenderforestError("Missing optional parameter: ${param}.");
}

if (!isset($payload[$param])) {
if (!isset($payload) || !sizeof($payload) || !isset($payload[$param])) {
return '';

}

return $payload[$param];
Expand Down
2 changes: 1 addition & 1 deletion src/Resource/Projects.php
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ public function deleteProjectVideos($payload)

$options = [
'method' => 'DELETE',
'endpoints' => "{$this->CONFIG['API_PREFIX']}/projects/$projectId/videos/$quality"
'endpoint' => "{$this->CONFIG['API_PREFIX']}/projects/$projectId/videos/$quality"
];
return $this->ApiRequest->authorizedRequest($options);
}
Expand Down

0 comments on commit 634da99

Please sign in to comment.