objectManager = $objectManager; } /** * Creates instance of message generator. * Throws exception if type of message generator does not have implementations. * * @param string $type * @return GeneratorInterface * @throws \InvalidArgumentException */ public function create($type) { $className = PatternGenerator::class; switch ($type) { case self::$caseCreation: $classConfig = [ 'template' => 'Signifyd Case %1 has been created for order.', 'requiredParams' => ['caseId'] ]; break; case self::$caseRescore: $classConfig = []; $className = CaseRescore::class; break; case self::$caseReview: $classConfig = [ 'template' => 'Case Update: Case Review was completed. Review Deposition is %1.', 'requiredParams' => ['reviewDisposition'] ]; break; case self::$guaranteeCompletion: $classConfig = [ 'template' => 'Case Update: Guarantee Disposition is %1.', 'requiredParams' => ['guaranteeDisposition'] ]; break; case self::$guaranteeCreation: $classConfig = [ 'template' => 'Case Update: Case is submitted for guarantee.' ]; break; case self::$guaranteeCancel: $classConfig = [ 'template' => 'Case Update: Case guarantee has been cancelled.' ]; break; default: throw new \InvalidArgumentException('Specified message type does not supported.'); } return $this->objectManager->create($className, $classConfig); } }