@@ -494,17 +494,18 @@ public function getCommit(string $owner, string $repositoryName, string $commitH
494494
495495 $ response = $ this ->call (self ::METHOD_GET , $ url , ['Authorization ' => "Bearer $ this ->accessToken " ]);
496496
497- if (!isset ($ response ['body ' ]['commit ' ]['author ' ]['name ' ]) || !isset ($ response ['body ' ]['commit ' ]['message ' ])) {
498- throw new Exception ("Commit author or message information missing. " );
499- }
497+ $ body = $ response ['body ' ] ?? [];
498+ $ author = $ body ['author ' ] ?? [];
499+ $ commit = $ body ['commit ' ] ?? [];
500+ $ commitAuthor = $ commit ['author ' ] ?? [];
500501
501502 return [
502- 'commitAuthor ' => $ response [ ' body ' ][ ' commit ' ][ ' author ' ][ ' name ' ] ,
503- 'commitMessage ' => $ response [ ' body ' ][ ' commit ' ][ ' message '] ,
504- 'commitAuthorAvatar ' => $ response [ ' body ' ][ ' author ' ] ['avatar_url ' ],
505- 'commitAuthorUrl ' => $ response [ ' body ' ][ ' author ' ] ['html_url ' ],
506- 'commitHash ' => $ response [ ' body ' ] ['sha ' ],
507- 'commitUrl ' => $ response [ ' body ' ] ['html_url ' ],
503+ 'commitAuthor ' => $ commitAuthor [ ' name ' ] ?? ' Unknown ' ,
504+ 'commitMessage ' => $ commit [ ' message ' ] ?? ' No message ' ,
505+ 'commitAuthorAvatar ' => $ author ['avatar_url ' ] ?? '' ,
506+ 'commitAuthorUrl ' => $ author ['html_url ' ] ?? '' ,
507+ 'commitHash ' => $ body ['sha ' ] ?? '' ,
508+ 'commitUrl ' => $ body ['html_url ' ] ?? '' ,
508509 ];
509510 }
510511
0 commit comments