id = (int) $this->id; // F032 — B18 defensive cast. Post-migration invariant: server_id is NEVER NULL (SQL NOT NULL). $this->server_id = (int) $this->server_id; } /** * Return this row as an array. `redirect_uris` decoded to array. * * @return array */ public function to_array(): array { return array( 'id' => $this->id, 'client_id' => $this->client_id, 'server_id' => $this->server_id, 'client_secret_hash' => $this->client_secret_hash, 'client_name' => $this->client_name, 'redirect_uris' => $this->decoded_redirect_uris(), 'grant_types' => $this->grant_types, 'token_endpoint_auth_method' => $this->token_endpoint_auth_method, 'connector_slug' => $this->connector_slug, 'metadata_fingerprint' => $this->metadata_fingerprint, 'created_at' => $this->created_at, ); } /** * Decode the JSON-encoded redirect_uris column into an array. Callers who * need it are the authorize/token endpoints — the byte-match is against * these individual entries. * * @return array */ public function decoded_redirect_uris(): array { if ( '' === $this->redirect_uris ) { return array(); } $decoded = json_decode( $this->redirect_uris, true ); return is_array( $decoded ) ? array_values( array_filter( $decoded, 'is_string' ) ) : array(); } }