Passed
Push — master ( f218e6...f51c1b )
by Arthur
04:59
created

Notification::delete()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: arthur
5
 * Date: 04.10.18
6
 * Time: 16:17.
7
 */
8
9
namespace Modules\Machine\Services;
10
11
use Modules\Machine\Contracts\NotificationServiceContract;
0 ignored issues
show
Bug introduced by
The type Modules\Machine\Contract...ficationServiceContract 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...
12
use Modules\Machine\Entities\Machine;
13
use Modules\Machine\Events\MachineRegisteredEvent;
14
15
class Notification implements NotificationServiceContract
16
{
17
    public function find($id): ?Machine
18
    {
19
        return Machine::find($id);
20
    }
21
22
    public function update($id, $data): Machine
23
    {
24
        $user = $this->find($id);
25
        $user->update($data);
26
27
        return $user;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $user could return the type null which is incompatible with the type-hinted return Modules\Machine\Entities\Machine. Consider adding an additional type-check to rule them out.
Loading history...
28
    }
29
30
    public function create($data): Machine
31
    {
32
        $machine = Machine::create($data);
33
        event(new MachineRegisteredEvent($machine));
34
35
        return $machine;
36
    }
37
38
    public function delete($id): bool
39
    {
40
        return Machine::destroy($id);
0 ignored issues
show
Bug Best Practice introduced by
The expression return Modules\Machine\E...s\Machine::destroy($id) returns the type integer which is incompatible with the type-hinted return boolean.
Loading history...
41
    }
42
}
43