Test Failed
Push — master ( f21b2a...0b0868 )
by Burak
06:41 queued 29s
created

Show   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 7
c 1
b 0
f 0
dl 0
loc 15
ccs 0
cts 7
cp 0
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A mount() 0 4 1
A render() 0 4 1
1
<?php
2
3
namespace App\Http\Livewire\Contact;
4
5
use App\Interfaces\ContactServiceInterface;
6
use App\Models\Contact;
7
use App\Models\User;
8
use Illuminate\Support\Facades\Auth;
9
use Livewire\Component;
10
11
class Show extends Component
12
{
13
    public User $user;
14
    public Contact $contact;
15
16
    public function mount(string $id, ContactServiceInterface $contactService)
17
    {
18
        $this->user = Auth::user();
19
        $this->contact = $contactService->contact($id, $this->user) ?? abort(404);
0 ignored issues
show
Bug introduced by
Are you sure the usage of abort(404) is correct as it seems to always return null.

This check looks for function or method calls that always return null and whose return value is used.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
if ($a->getObject()) {

The method getObject() can return nothing but null, so it makes no sense to use the return value.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
20
    }
21
22
    public function render()
23
    {
24
        return view('livewire.contact.show', [
25
            'contact' => $this->contact,
26
        ]);
27
    }
28
}
29