Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix-optional-parameter-issue #125

Merged
merged 3 commits into from
Feb 8, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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