Conditions | 2 |
Paths | 2 |
Total Lines | 19 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
1 | <?php |
||
18 | public function getFeedContent(array $feedConfiguration) : string |
||
19 | { |
||
20 | if (!str_contains($feedConfiguration['items'], '@')) { |
||
21 | throw InvalidConfiguration::delimiterNotPresent($feedConfiguration['items']); |
||
22 | } |
||
23 | |||
24 | list($class, $method) = explode('@', $feedConfiguration['items']); |
||
25 | |||
26 | $items = app($class)->$method(); |
||
27 | |||
28 | $meta = [ |
||
29 | 'link' => $feedConfiguration['url'], |
||
30 | 'description' => $feedConfiguration['description'], |
||
31 | 'title' => $feedConfiguration['title'], |
||
32 | 'updated' => $this->getLastUpdatedDate($items, 'Y-m-d H:i:s'), |
||
33 | ]; |
||
34 | |||
35 | return view('laravel-feed::feed', compact('meta', 'items'))->render(); |
||
|
|||
36 | } |
||
37 | |||
49 |
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: