| Conditions | 4 |
| Paths | 4 |
| Total Lines | 21 |
| Code Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 16 | public function transform(Payee $payee) |
||
| 17 | { |
||
| 18 | $data = [ |
||
| 19 | 'id' => $payee->id, |
||
| 20 | 'name' => $payee->name, |
||
| 21 | ]; |
||
| 22 | |||
| 23 | $category = null; |
||
|
|
|||
| 24 | if ($category = Category::find($payee->last_category_id)) { |
||
| 25 | if ($category) { |
||
| 26 | if ($category->parent_id) { |
||
| 27 | $data['category_id'] = $category->parent_id; |
||
| 28 | $data['sub_category_id'] = $category->id; |
||
| 29 | } else { |
||
| 30 | $data['category_id'] = $category->id; |
||
| 31 | } |
||
| 32 | } |
||
| 33 | } |
||
| 34 | |||
| 35 | return $data; |
||
| 36 | } |
||
| 37 | } |
||
| 38 |
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.
Both the
$myVarassignment in line 1 and the$higherassignment in line 2 are dead. The first because$myVaris never used and the second because$higheris always overwritten for every possible time line.