File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -61,11 +61,11 @@ public function __construct(API $api) {
6161 * @throws RuntimeException on error
6262 */
6363 protected function requireSuccessFor (array $ result ): int {
64- if ((!array_key_exists ('id ' , $ result ) && !array_key_exists ('entry ' , $ result )) ||
65- (!is_numeric ($ result ['id ' ] ?? 0 ) && !is_numeric ($ result ['entry ' ] ?? 0 )) ||
66- !array_key_exists ('success ' , $ result ) ||
67- $ result ['success ' ] !== true ) {
64+ $ idExists = array_key_exists ('id ' , $ result ) || array_key_exists ('entry ' , $ result );
65+ $ idIsNumeric = is_numeric ($ result ['id ' ] ?? 0 ) || is_numeric ($ result ['entry ' ] ?? 0 );
66+ $ isSuccess = array_key_exists ('success ' , $ result ) && $ result ['success ' ] === true ;
6867
68+ if (!$ idExists || !$ idIsNumeric || !$ isSuccess ) {
6969 if (array_key_exists ('message ' , $ result )) {
7070 throw new RuntimeException (sprintf ('Bad result: %s ' , $ result ['message ' ]));
7171 } else {
You can’t perform that action at this time.
0 commit comments