Conditions | 4 |
Paths | 8 |
Total Lines | 15 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
16 | public function parse() { |
||
17 | $options = $this->param->options ? json_decode($this->param->options, true) : []; |
||
|
|||
18 | $modelName = get_class($this->model); |
||
19 | $cols = $modelName::$cols; |
||
20 | $value = $this->data; |
||
21 | if (is_array($value)) { |
||
22 | $value = ''; |
||
23 | } |
||
24 | $paramValue = \Ecommerce\Item\Param::get([[['item_id', $this->model->id], ['item_option_id', $this->param->value]]]); |
||
25 | if (!$paramValue) { |
||
26 | $paramValue = new \Ecommerce\Item\Param(['item_id' => $this->model->id, 'item_option_id' => $this->param->value]); |
||
27 | } |
||
28 | $paramValue->value = $value; |
||
29 | $paramValue->save(); |
||
30 | } |
||
31 | } |
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.