label)) { return (string) $this->label; } if (! filled($this->type) && ! filled($this->id)) { return null; } $type = is_string($this->type) && trim($this->type) !== '' ? trim(str_replace(['_', '.'], ' ', $this->type)) : 'Record'; $type = ucfirst($type); if (filled($this->id)) { return sprintf('%s #%s', $type, (string) $this->id); } return $type; } /** * @return array{target_type: ?string, target_id: int|string|null, target_label: ?string} */ public function toArray(): array { return [ 'target_type' => $this->type, 'target_id' => $this->id, 'target_label' => $this->labelOrFallback(), ]; } }