Conditions | 2 |
Paths | 2 |
Total Lines | 9 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 6 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
38 | public function handle() |
||
39 | { |
||
40 | // |
||
41 | $companyId = $this->argument('companyId'); |
||
42 | if (is_numeric($companyId)) |
||
43 | print_r(Company::with(self::withFilter())->findOrFail($companyId)->toArray()); |
||
|
|||
44 | else |
||
45 | print_r(Company::with(self::withFilter())->select('id')->get()->toArray()); |
||
46 | } |
||
47 | |||
59 |
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: