NotificationViewComposer   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A compose() 0 5 1
1
<?php
2
3
namespace Modules\Notification\Composers;
4
5
use Illuminate\Contracts\View\View;
6
use Modules\Notification\Repositories\NotificationRepository;
7
use Modules\User\Contracts\Authentication;
8
9
class NotificationViewComposer
10
{
11
    /**
12
     * @var NotificationRepository
13
     */
14
    private $notification;
15
    /**
16
     * @var Authentication
17
     */
18
    private $auth;
19
20
    public function __construct(NotificationRepository $notification, Authentication $auth)
21
    {
22
        $this->notification = $notification;
23
        $this->auth = $auth;
24
    }
25
26
    public function compose(View $view)
27
    {
28
        $notifications = $this->notification->latestForUser($this->auth->id());
29
        $view->with('notifications', $notifications);
30
    }
31
}
32