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

NotificationsComposer::compose()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 5
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 8
rs 10
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