diff --git a/composer.json b/composer.json index 5ec6af4..98355a8 100644 --- a/composer.json +++ b/composer.json @@ -1,7 +1,7 @@ { "name": "renderforest/sdk-php", "description": "Renderforest SDK for PHP", - "version": "0.4.1", + "version": "0.4.2", "homepage": "https://github.com/renderforest/renderforest-sdk-php", "authors": [ { diff --git a/src/ProjectData/ProjectDataStyles.php b/src/ProjectData/ProjectDataStyles.php index 7e9f991..62527c1 100644 --- a/src/ProjectData/ProjectDataStyles.php +++ b/src/ProjectData/ProjectDataStyles.php @@ -21,11 +21,6 @@ class ProjectDataStyles extends ApiEntityBase const KEY_THEME = 'theme'; const KEY_TRANSITION = 'transition'; - const REQUIRED_KEYS = [ - self::KEY_THEME, - self::KEY_TRANSITION, - ]; - /** @var string */ protected $theme; @@ -37,7 +32,7 @@ class ProjectDataStyles extends ApiEntityBase */ public function getTheme(): string { - return $this->theme; + return $this->theme || ''; } /** @@ -56,7 +51,7 @@ public function setTheme(string $theme): ProjectDataStyles */ public function getTransition(): string { - return $this->transition; + return $this->transition || ''; } /** @@ -72,21 +67,18 @@ public function setTransition(string $transition): ProjectDataStyles /** * @param array $projectDataStylesArrayData - * @throws \Exception */ public function exchangeArray(array $projectDataStylesArrayData) { - foreach (self::REQUIRED_KEYS as $requiredKey) { - if (false === array_key_exists($requiredKey, $projectDataStylesArrayData)) { - throw new \Exception('Missing `' . $requiredKey . '` in project data styles array data'); - } + if (true === array_key_exists(self::KEY_THEME, $projectDataStylesArrayData)) { + $projectDataStylesTheme = $projectDataStylesArrayData[self::KEY_THEME]; + $this->setTheme($projectDataStylesTheme); } - $projectDataStylesTheme = $projectDataStylesArrayData[self::KEY_THEME]; - $projectDataStylesTransition = $projectDataStylesArrayData[self::KEY_TRANSITION]; - - $this->setTheme($projectDataStylesTheme); - $this->setTransition($projectDataStylesTransition); + if (true === array_key_exists(self::KEY_TRANSITION, $projectDataStylesArrayData)) { + $projectDataStylesTransition = $projectDataStylesArrayData[self::KEY_TRANSITION]; + $this->setTransition($projectDataStylesTransition); + } } /**