Completed
Push — master ( 8b8ff2...a0185d )
by Quim González
04:27
created

TaskObserver::retrieved()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 0

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 2
rs 10
c 0
b 0
f 0
cc 1
eloc 0
nc 1
nop 1
1
<?php
2
3
namespace App\Observers;
4
5
use App\Task;
6
use App\TaskEvent;
7
use Carbon\Carbon;
8
9
/**
10
 * Created by PhpStorm.
11
 * User: quim
12
 * Date: 15/02/18
13
 * Time: 21:13
14
 */
15
16
class TaskObserver{
17
18
19
    /**
20
     * @param Task $task
21
     */
22
    public function created(Task $task)
23
    {
24
25
        TaskEvent::create([
26
27
            'time' => Carbon::now(),
28
            'type' => 'created',
29
            'task_name' => $task->name,
30
            'user_name' => $task->user->name,
0 ignored issues
show
Bug Best Practice introduced by
The property name does not exist on App\User. Since you implemented __get, consider adding a @property annotation.
Loading history...
31
32
33
        ]);
34
35
36
37
    }
38
39
    /**
40
     * @param User $task
0 ignored issues
show
Bug introduced by
The type App\Observers\User 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...
41
     */
42
    public function retrieved(Task $task)
0 ignored issues
show
Unused Code introduced by
The parameter $task 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

42
    public function retrieved(/** @scrutinizer ignore-unused */ Task $task)

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...
43
    {
44
45
    }
46
47
48
    public function updated (Task $task)
0 ignored issues
show
Unused Code introduced by
The parameter $task 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

48
    public function updated (/** @scrutinizer ignore-unused */ Task $task)

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...
49
    {
50
51
    }
52
}