@@ -21,11 +21,6 @@ class ProjectDataStyles extends ApiEntityBase
2121 const KEY_THEME = 'theme ' ;
2222 const KEY_TRANSITION = 'transition ' ;
2323
24- const REQUIRED_KEYS = [
25- self ::KEY_THEME ,
26- self ::KEY_TRANSITION ,
27- ];
28-
2924 /** @var string */
3025 protected $ theme ;
3126
@@ -37,7 +32,7 @@ class ProjectDataStyles extends ApiEntityBase
3732 */
3833 public function getTheme (): string
3934 {
40- return $ this ->theme ;
35+ return $ this ->theme || '' ;
4136 }
4237
4338 /**
@@ -56,7 +51,7 @@ public function setTheme(string $theme): ProjectDataStyles
5651 */
5752 public function getTransition (): string
5853 {
59- return $ this ->transition ;
54+ return $ this ->transition || '' ;
6055 }
6156
6257 /**
@@ -72,21 +67,18 @@ public function setTransition(string $transition): ProjectDataStyles
7267
7368 /**
7469 * @param array $projectDataStylesArrayData
75- * @throws \Exception
7670 */
7771 public function exchangeArray (array $ projectDataStylesArrayData )
7872 {
79- foreach (self ::REQUIRED_KEYS as $ requiredKey ) {
80- if (false === array_key_exists ($ requiredKey , $ projectDataStylesArrayData )) {
81- throw new \Exception ('Missing ` ' . $ requiredKey . '` in project data styles array data ' );
82- }
73+ if (true === array_key_exists (self ::KEY_THEME , $ projectDataStylesArrayData )) {
74+ $ projectDataStylesTheme = $ projectDataStylesArrayData [self ::KEY_THEME ];
75+ $ this ->setTheme ($ projectDataStylesTheme );
8376 }
8477
85- $ projectDataStylesTheme = $ projectDataStylesArrayData [self ::KEY_THEME ];
86- $ projectDataStylesTransition = $ projectDataStylesArrayData [self ::KEY_TRANSITION ];
87-
88- $ this ->setTheme ($ projectDataStylesTheme );
89- $ this ->setTransition ($ projectDataStylesTransition );
78+ if (true === array_key_exists (self ::KEY_TRANSITION , $ projectDataStylesArrayData )) {
79+ $ projectDataStylesTransition = $ projectDataStylesArrayData [self ::KEY_TRANSITION ];
80+ $ this ->setTransition ($ projectDataStylesTransition );
81+ }
9082 }
9183
9284 /**
0 commit comments