getMessage()); wp_die(); } $result = ''; if (method_exists(__CLASS__, $testId)) { // The following call sets self::$next. $result = call_user_func(array(__CLASS__, $testId)); } else { $result = ['Unknown test: ' . $testId]; self::$next = 'break'; } $response = [ 'result' => $result, 'next' => self::$next ]; echo json_encode($response, JSON_UNESCAPED_SLASHES | JSON_NUMERIC_CHECK | JSON_PRETTY_PRINT); wp_die(); } }