Conditions | 2 |
Paths | 1 |
Total Lines | 22 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php namespace jlourenco\support\Traits; |
||
12 | public static function bootCreation() |
||
13 | { |
||
14 | |||
15 | // create a event to happen on updating |
||
16 | static::updating(function($table) { |
||
17 | $table->modified_by = Sentinel::getUser()->id; |
||
18 | }); |
||
19 | |||
20 | // create a event to happen on deleting |
||
21 | static::deleting(function($table) { |
||
22 | $table->deleted_by = Sentinel::getUser()->id; |
||
23 | }); |
||
24 | |||
25 | // create a event to happen on saving |
||
26 | static::saving(function($table) { |
||
27 | |||
28 | if ($user = Sentinel::check()) |
||
|
|||
29 | $table->created_by = Sentinel::getUser()->id; |
||
30 | |||
31 | }); |
||
32 | |||
33 | } |
||
34 | |||
35 | } |
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.
Both the
$myVar
assignment in line 1 and the$higher
assignment in line 2 are dead. The first because$myVar
is never used and the second because$higher
is always overwritten for every possible time line.