check_key = $check_key; $this->severity = $severity; $this->message = $message; $this->location = $location; } /** @param array $payload API boundary payload. */ public static function from_payload( array $payload ): ?self { $check_key = $payload['check_key'] ?? null; $severity = $payload['severity'] ?? null; $message = $payload['message'] ?? null; $location = $payload['location'] ?? null; if ( ! is_string( $check_key ) || ! is_string( $severity ) || ! is_string( $message ) ) { return null; } $location = is_array( $location ) ? RunFindingLocation::from_payload( $location ) : null; return $location instanceof RunFindingLocation ? new self( $check_key, $severity, $message, $location ) : null; } /** @return array Local option boundary payload. */ public function to_payload(): array { return array( 'check_key' => $this->check_key, 'severity' => $this->severity, 'message' => $this->message, 'location' => $this->location->to_payload(), ); } }