Skip to content

Commit 634da99

Browse files
Merge pull request #125 from renderforest/fix-optional-parameter-issue
fix-optional-parameter-issue
2 parents 26c81df + 495d76e commit 634da99

File tree

3 files changed

+6
-9
lines changed

3 files changed

+6
-9
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "renderforest/sdk-php",
33
"description": "Renderforest SDK for PHP",
4-
"version": "0.3.10",
4+
"version": "0.3.11",
55
"homepage": "https://github.com/renderforest/renderforest-sdk-php",
66
"authors": [
77
{

src/Params.php

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,19 +52,16 @@ public function destructURLParam($payload, $param)
5252

5353
/**
5454
* Destructs optional URL param from the given payload.
55-
* @param $payload - Thr array to destruct.
56-
* @param $param - The param to destruct from array.
55+
* @param array $payload - Thr array to destruct.
56+
* @param string $param - The param to destruct from array.
5757
* @return string
5858
* @throws RenderforestError
5959
*/
6060
public function destructOptionalURLParam($payload, $param)
6161
{
62-
if (!isset($payload) || sizeof($payload)) {
63-
throw new RenderforestError("Missing optional parameter: ${param}.");
64-
}
65-
66-
if (!isset($payload[$param])) {
62+
if (!isset($payload) || !sizeof($payload) || !isset($payload[$param])) {
6763
return '';
64+
6865
}
6966

7067
return $payload[$param];

src/Resource/Projects.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ public function deleteProjectVideos($payload)
152152

153153
$options = [
154154
'method' => 'DELETE',
155-
'endpoints' => "{$this->CONFIG['API_PREFIX']}/projects/$projectId/videos/$quality"
155+
'endpoint' => "{$this->CONFIG['API_PREFIX']}/projects/$projectId/videos/$quality"
156156
];
157157
return $this->ApiRequest->authorizedRequest($options);
158158
}

0 commit comments

Comments
 (0)