Skip to content

Commit 079c230

Browse files
authored
Merge pull request #139 from renderforest/fix-screen-and-theme
Fix screen and theme
2 parents 440288e + 5834626 commit 079c230

File tree

3 files changed

+31
-9
lines changed

3 files changed

+31
-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.4.5",
4+
"version": "0.4.6",
55
"homepage": "https://github.com/renderforest/renderforest-sdk-php",
66
"authors": [
77
{

src/ProjectData/ProjectDataStyles.php

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,17 @@ public function exchangeArray(array $projectDataStylesArrayData)
8686
*/
8787
public function getArrayCopy(): array
8888
{
89-
$arrayCopy = [
90-
self::KEY_THEME => $this->getTheme(),
91-
self::KEY_TRANSITION => $this->getTransition(),
92-
];
89+
$arrayCopy = [];
90+
$theme = $this->getTheme();
91+
$transition = $this->getTransition();
92+
93+
if ($theme !== '') {
94+
$arrayCopy[self::KEY_THEME] = $theme;
95+
}
96+
97+
if ($transition) {
98+
$arrayCopy[self::KEY_TRANSITION] = $transition;
99+
}
93100

94101
return $arrayCopy;
95102
}

src/ProjectData/Screen/Entity/Screen.php

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ private function calculateVideoTrimsDuration(VideoArea $area)
186186
*/
187187
public function setLowerThirdSettings(int $start, int $duration): Screen
188188
{
189-
if (1 === $this->lowerThirdAdjustable) {
189+
if (true === $this->lowerThirdAdjustable) {
190190
$this->lowerThirdStart = $start;
191191
$this->lowerThirdDuration = $duration;
192192
} else {
@@ -196,6 +196,14 @@ public function setLowerThirdSettings(int $start, int $duration): Screen
196196
return $this;
197197
}
198198

199+
/**
200+
* @return bool
201+
*/
202+
private function getLowerThirdAdjustable()
203+
{
204+
return $this->lowerThirdAdjustable;
205+
}
206+
199207
/**
200208
* @return Screen
201209
* @throws \Exception
@@ -484,10 +492,10 @@ private function setIconAdjustable(int $iconAdjustable): Screen
484492
}
485493

486494
/**
487-
* @param int $lowerThirdAdjustable
495+
* @param bool $lowerThirdAdjustable
488496
* @return Screen
489497
*/
490-
private function setLowerThirdAdjustable(int $lowerThirdAdjustable): Screen
498+
private function setLowerThirdAdjustable(bool $lowerThirdAdjustable): Screen
491499
{
492500
$this->lowerThirdAdjustable = $lowerThirdAdjustable;
493501

@@ -774,14 +782,17 @@ public function getArrayCopy(): array
774782
self::KEY_GIF_PATH => $this->getGifPath(),
775783
self::KEY_GIF_THUMBNAIL_PATH => $this->getGifThumbnailPath(),
776784
self::KEY_HIDDEN => $this->getHidden(),
777-
self::KEY_MAX_DURATION => $this->getMaxDuration(),
778785
self::KEY_ORDER => $this->getOrder(),
779786
self::KEY_PATH => $this->getPath(),
780787
self::KEY_TAGS => $this->getTags(),
781788
self::KEY_TYPE => $this->getType(),
782789
self::KEY_AREAS => $this->areas->getArrayCopy(),
783790
];
784791

792+
if (false === is_null($this->getMaxDuration())) {
793+
$arrayCopy[self::KEY_MAX_DURATION] = $this->getMaxDuration();
794+
}
795+
785796
if (false === is_null($this->getTitle())) {
786797
$arrayCopy[self::KEY_TITLE] = $this->getTitle();
787798
}
@@ -794,6 +805,10 @@ public function getArrayCopy(): array
794805
$arrayCopy[self::KEY_ICON_ADJUSTABLE] = $this->getIconAdjustable();
795806
}
796807

808+
if (false === is_null($this->getLowerThirdAdjustable())) {
809+
$arrayCopy[self::KEY_LOWER_THIRD_ADJUSTABLE] = $this->getLowerThirdAdjustable();
810+
}
811+
797812
if (
798813
false === is_null($this->lowerThirdStart)
799814
&&

0 commit comments

Comments
 (0)