| Conditions | 2 |
| Paths | 2 |
| Total Lines | 10 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 6 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 34 | public function unitAdd($snId, $level) { |
||
| 35 | if($this->indexIsSet($snId)) { |
||
| 36 | $this->indexGetObject($snId)->$level += $level; |
||
| 37 | } else { |
||
| 38 | $unit = \classSupernova::$gc->unitModel->buildContainer(); |
||
| 39 | $unit->snId = $snId; |
||
| 40 | $unit->level = $level; |
||
| 41 | $this->attach($unit, $snId); |
||
| 42 | } |
||
| 43 | } |
||
| 44 | |||
| 46 |
It seems like the method you are trying to call exists only in some of the possible types.
Let’s take a look at an example:
Available Fixes
Add an additional type-check:
Only allow a single type to be passed if the variable comes from a parameter: