!is_null($param))); $this->decision = $decision; } public function getDecision(): ?Decision { return $this->decision; } public static function getDataDescriptions(): array { $variables = parent::getDataDescriptions(); $variables[self::DECISION_DESCRIPTION] = __('mailable.decision.notifyReviewer.variable.decisionDescription'); return $variables; } public function setData(?string $locale = null): void { parent::setData($locale); if ($this->decision) { $this->viewData[self::DECISION_DESCRIPTION] = $this->getDecisionDescription($locale); } } /** * Get a description of the decision to use as an email variable */ protected function getDecisionDescription(?string $locale = null): string { $class = Decision::class; $reviewerUnassignedTypes = collect([ 'CANCEL_REVIEW_ROUND', 'CANCEL_INTERNAL_REVIEW_ROUND', ]) ->map(fn ($type) => defined("{$class}::{$type}") ? constant("{$class}::{$type}") : null) ->filter(fn ($type) => !is_null($type)) ->toArray(); if (in_array($this->decision->getData('decision'), $reviewerUnassignedTypes)) { return __('mailable.decision.notifyReviewer.variable.decisionDescription.unassigned', [], $locale); } return ''; } }