getSourceId()) { throw new RuntimeException("Attachment w/o a source ID."); } $this->attachment = $attachment; } public function getSourceId(): string { $sourceId = $this->attachment->getSourceId(); if (!$sourceId) { throw new RuntimeException("Attachment w/o a source ID."); } return $sourceId; } }