Passed
Push — master ( 46427f...5263c8 )
by Burak
07:19
created

PushNotificationForm   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
eloc 5
c 0
b 0
f 0
dl 0
loc 12
ccs 0
cts 7
cp 0
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A pushNotification() 0 5 1
A render() 0 3 1
1
<?php
2
3
namespace App\Http\Livewire\Data;
4
5
use App\Interfaces\MessageServiceInterface;
6
use App\Models\Message;
7
use Illuminate\Support\Facades\Auth;
8
use Livewire\Component;
9
10
class PushNotificationForm extends Component
11
{
12
    public function pushNotification(MessageServiceInterface $messageService)
13
    {
14
        $subject = 'PING '.now();
15
        $message = Message::factory()->make();
16
        $messageService->newThread($subject, Auth::user(), $message->body);
0 ignored issues
show
Bug introduced by
It seems like Illuminate\Support\Facades\Auth::user() can also be of type null; however, parameter $user of App\Interfaces\MessageSe...eInterface::newThread() does only seem to accept App\Models\User, 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

16
        $messageService->newThread($subject, /** @scrutinizer ignore-type */ Auth::user(), $message->body);
Loading history...
17
    }
18
19
    public function render()
20
    {
21
        return view('livewire.data.push-notification-form');
22
    }
23
}
24