Completed
Push — master ( 8a32e8...44da47 )
by Fèvre
21s queued 14s
created

NotificationsComposer   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 6
c 1
b 0
f 0
dl 0
loc 16
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A compose() 0 8 1
1
<?php
2
namespace Xetaravel\View\Composers;
3
4
use Illuminate\Support\Facades\Auth;
5
use Illuminate\View\View;
6
use Xetaravel\Models\Repositories\UserRepository;
7
8
class NotificationsComposer
9
{
10
    /**
11
     * Bind data to the view.
12
     *
13
     * @param  \Illuminate\View\View  $view
14
     * @return void
15
     */
16
    public function compose(View $view)
17
    {
18
        $notifications = UserRepository::notificationsData(Auth::id());
0 ignored issues
show
Bug introduced by
It seems like Illuminate\Support\Facades\Auth::id() can also be of type string; however, parameter $userId of Xetaravel\Models\Reposit...ry::notificationsData() does only seem to accept integer, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

18
        $notifications = UserRepository::notificationsData(/** @scrutinizer ignore-type */ Auth::id());
Loading history...
19
20
        $view->with([
21
            'notifications' => $notifications['notifications'],
22
            'hasUnreadNotifications' => $notifications['hasUnreadNotifications'],
23
            'unreadNotificationsCount' => $notifications['unreadNotificationsCount']
24
        ]);
25
    }
26
}
27