| Conditions | 2 |
| Paths | 2 |
| Total Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 6 |
| Changes | 0 | ||
| 1 | <?php |
||
| 17 | public function switchSortable() |
||
| 18 | { |
||
| 19 | $this->init(); |
||
| 20 | $this->bound(); |
||
| 21 | |||
| 22 | if (!$this->crud()->isSortableByWeight()) { |
||
| 23 | throw new PermissionDenied(); |
||
| 24 | } |
||
| 25 | |||
| 26 | $newState = !$this->crud()->isSortableByWeightActive(); |
||
| 27 | $this->crud()->setSortableOrderState($newState); |
||
| 28 | |||
| 29 | return back(); |
||
| 30 | } |
||
| 31 | |||
| 61 |
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: