mirror of
https://github.com/quentin-g-dev/afup.git
synced 2026-03-26 02:02:15 +01:00
41 lines
1.1 KiB
PHP
41 lines
1.1 KiB
PHP
<?php
|
|
|
|
|
|
namespace AppBundle\Association\UserMembership;
|
|
|
|
use AppBundle\Association\MembershipReminderInterface;
|
|
use AppBundle\Association\Model\Repository\SubscriptionReminderLogRepository;
|
|
use AppBundle\Email\Mailer\Mailer;
|
|
|
|
class UserReminderFactory
|
|
{
|
|
/**
|
|
* @var Mailer
|
|
*/
|
|
private $mailer;
|
|
|
|
/**
|
|
* @var SubscriptionReminderLogRepository
|
|
*/
|
|
private $subscriptionReminderLogRepository;
|
|
|
|
public function __construct(Mailer $mailer, SubscriptionReminderLogRepository $subscriptionReminderLogRepository)
|
|
{
|
|
$this->mailer = $mailer;
|
|
$this->subscriptionReminderLogRepository = $subscriptionReminderLogRepository;
|
|
}
|
|
|
|
/**
|
|
* @param $class
|
|
* @return MembershipReminderInterface
|
|
*/
|
|
public function getReminder($class)
|
|
{
|
|
$instance = new $class($this->mailer, AFUP_COTISATION_PERSONNE_PHYSIQUE, $this->subscriptionReminderLogRepository);
|
|
if (!$instance instanceof AbstractUserReminder) {
|
|
throw new \RuntimeException(sprintf('The class %s is not an instance of AbstractUserReminder', $class));
|
|
}
|
|
return $instance;
|
|
}
|
|
}
|