GuestObserver   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 6
c 2
b 0
f 0
dl 0
loc 19
rs 10
wmc 4

3 Methods

Rating   Name   Duplication   Size   Complexity  
A created() 0 3 1
A updated() 0 2 1
A deleted() 0 5 2
1
<?php
2
3
namespace Innoflash\Events\Observers;
4
5
use FaithGen\SDK\Traits\FileTraits;
6
use Innoflash\Events\Guest\Saved;
0 ignored issues
show
Bug introduced by
The type Innoflash\Events\Guest\Saved was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
7
use Innoflash\Events\Models\Guest;
8
9
class GuestObserver
10
{
11
    use FileTraits;
12
13
    public function deleted(Guest $guest)
14
    {
15
        if ($guest->image()->exists()) {
16
            $this->deleteFiles($guest);
17
            $guest->image()->delete();
18
        }
19
    }
20
21
    public function created(Guest $guest)
22
    {
23
        event(new Saved($guest, request('image')));
24
    }
25
26
    public function updated(Guest $guest)
0 ignored issues
show
Unused Code introduced by
The parameter $guest is not used and could be removed. ( Ignorable by Annotation )

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

26
    public function updated(/** @scrutinizer ignore-unused */ Guest $guest)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
27
    {
28
    }
29
}
30