@@ -14,8 +14,8 @@ class JobData implements JsonSerializable
1414 private string $ jobEndTime ;
1515 private string $ componentId ;
1616 private string $ componentName ;
17- private string $ configurationId ;
18- private string $ configurationName ;
17+ private ? string $ configurationId ;
18+ private ? string $ configurationName ;
1919
2020 public function __construct (
2121 string $ jobId ,
@@ -24,8 +24,8 @@ public function __construct(
2424 string $ jobEndTime ,
2525 string $ componentId ,
2626 string $ componentName ,
27- string $ configurationId ,
28- string $ configurationName
27+ ? string $ configurationId ,
28+ ? string $ configurationName
2929 ) {
3030 $ this ->jobId = $ jobId ;
3131 $ this ->jobUrl = $ jobUrl ;
@@ -42,7 +42,7 @@ public function __construct(
4242 */
4343 public function jsonSerialize ()
4444 {
45- return [
45+ $ result = [
4646 'id ' => $ this ->jobId ,
4747 'url ' => $ this ->jobUrl ,
4848 'startTime ' => $ this ->jobStartTime ,
@@ -51,11 +51,14 @@ public function jsonSerialize()
5151 'id ' => $ this ->componentId ,
5252 'name ' => $ this ->componentName ,
5353 ],
54- 'configuration ' => [
55- 'id ' => $ this ->configurationId ,
56- 'name ' => $ this ->configurationName ,
57- ],
5854 'tasks ' => [],
5955 ];
56+ if ($ this ->configurationId && $ this ->configurationName ) {
57+ $ result ['configuration ' ] = [
58+ 'id ' => $ this ->configurationId ,
59+ 'name ' => $ this ->configurationName ,
60+ ];
61+ }
62+ return $ result ;
6063 }
6164}
0 commit comments