template = $template; $this->requiredParams = $requiredParams; } /** * @inheritdoc */ public function generate(array $data) { $placeholders = []; foreach ($this->requiredParams as $param) { if (empty($data[$param])) { throw new GeneratorException(__('The "%1" should not be empty.', $param)); } $placeholders[] = $data[$param]; } return __($this->template, ...$placeholders); } }