Test Failed
Push — master ( 6f7a22...abd8b8 )
by Hirofumi
31:24
created

SendFreshNotificationsHandler   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 2
dl 0
loc 35
c 0
b 0
f 0
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 1
A handle() 0 7 2
1
<?php
2
declare(strict_types=1);
3
4
namespace Shippinno\Notification\Application\Command;
5
6
use Shippinno\Notification\Domain\Model\NotificationRepository;
7
use Shippinno\Notification\Domain\Model\SendNotification as SendNotificationService;
8
9
class SendFreshNotificationsHandler
10
{
11
    /**
12
     * @var NotificationRepository
13
     */
14
    private $notificationRepository;
15
16
    /**
17
     * @var SendNotificationService
18
     */
19
    private $sendNotificationService;
20
21
    /**
22
     * @param NotificationRepository $notificationRepository
23
     * @param SendNotificationService $sendNotificationService
24
     */
25
    public function __construct(
26
        NotificationRepository $notificationRepository,
27
        SendNotificationService $sendNotificationService
28
    ) {
29
        $this->notificationRepository = $notificationRepository;
30
        $this->sendNotificationService = $sendNotificationService;
31
    }
32
33
    /**
34
     * @param SendFreshNotifications $command
35
     */
36
    public function handle(SendFreshNotifications $command): void
1 ignored issue
show
Unused Code introduced by
The parameter $command is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
37
    {
38
        $notifications = $this->notificationRepository->unsentNotifications();
39
        foreach ($notifications as $notification) {
40
            $this->sendNotificationService->execute($notification);
41
        }
42
    }
43
}
44