Conditions | 2 |
Paths | 2 |
Total Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Tests | 6 |
CRAP Score | 2 |
Changes | 0 |
1 | <?php |
||
18 | 1 | public function handle() |
|
19 | { |
||
20 | /** @var EmailsTrait $emailsManager */ |
||
21 | 1 | $emailsManager = ModelLocator::get('emails'); |
|
22 | |||
23 | 1 | $types = $emailsManager::reduceEmailsByType(); |
|
24 | 1 | foreach ($types as $type => $days) { |
|
25 | 1 | $this->deleteByType($emailsManager, $type, $days); |
|
26 | } |
||
27 | 1 | } |
|
28 | |||
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: