url = $url; $this->role = $role; $this->device_profile = $device_profile; } /** @return array{url: string, role: string, device_profile: string} API boundary payload. */ public function to_payload(): array { return array( 'url' => $this->url, 'role' => $this->role, 'device_profile' => $this->device_profile, ); } /** @param array $payload WordPress Cron boundary payload. */ public static function from_payload( array $payload ): ?self { $url = $payload['url'] ?? null; $role = $payload['role'] ?? null; $profile = $payload['device_profile'] ?? null; if ( ! is_string( $url ) || ! is_string( $role ) || ! is_string( $profile ) ) { return null; } return new self( $url, $role, $profile ); } }