mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-09-06 23:04:58 +00:00
cs: Fix code style (safe rules only).
This commit is contained in:
@@ -1,10 +1,18 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Chill is a software for social workers
|
||||
*
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Chill\MainBundle\Notification;
|
||||
|
||||
use Chill\ActivityBundle\Notification\ActivityNotificationRenderer;
|
||||
use Chill\MainBundle\Entity\Notification;
|
||||
use Chill\PersonBundle\Notification\AccompanyingPeriodNotificationRenderer;
|
||||
use Chill\ActivityBundle\Notification\ActivityNotificationRenderer;
|
||||
use Exception;
|
||||
|
||||
final class NotificationRenderer
|
||||
{
|
||||
@@ -12,7 +20,8 @@ final class NotificationRenderer
|
||||
|
||||
public function __construct(
|
||||
AccompanyingPeriodNotificationRenderer $accompanyingPeriodNotificationRenderer,
|
||||
ActivityNotificationRenderer $activityNotificationRenderer)
|
||||
ActivityNotificationRenderer $activityNotificationRenderer
|
||||
)
|
||||
{
|
||||
// TODO configure automatically
|
||||
// TODO CREER UNE INTERFACE POUR ETRE SUR QUE LES RENDERERS SONT OK
|
||||
@@ -21,17 +30,6 @@ final class NotificationRenderer
|
||||
$this->renderers[] = $activityNotificationRenderer;
|
||||
}
|
||||
|
||||
private function getRenderer(Notification $notification)
|
||||
{
|
||||
foreach ($this->renderers as $renderer) {
|
||||
if($renderer->supports($notification)) {
|
||||
return $renderer;
|
||||
}
|
||||
}
|
||||
|
||||
throw new \Exception('No renderer for '. $notification);
|
||||
}
|
||||
|
||||
public function getTemplate(Notification $notification)
|
||||
{
|
||||
return $this->getRenderer($notification)->getTemplate();
|
||||
@@ -41,4 +39,15 @@ final class NotificationRenderer
|
||||
{
|
||||
return $this->getRenderer($notification)->getTemplateData($notification);
|
||||
}
|
||||
|
||||
private function getRenderer(Notification $notification)
|
||||
{
|
||||
foreach ($this->renderers as $renderer) {
|
||||
if ($renderer->supports($notification)) {
|
||||
return $renderer;
|
||||
}
|
||||
}
|
||||
|
||||
throw new Exception('No renderer for ' . $notification);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user