| Conditions | 2 |
| Paths | 2 |
| Total Lines | 14 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 16 | public function handle($request, Closure $next) |
||
| 17 | { |
||
| 18 | $response = $next($request); |
||
| 19 | |||
| 20 | $shotcodes = config('asgard.core.shortcodes'); |
||
| 21 | |||
| 22 | foreach ($shotcodes as $shortcode => $options) { |
||
| 23 | $response->setContent( |
||
| 24 | str_replace("[$shortcode]", view($options['view'], $options['data'])->render(), $response->getContent()) |
||
|
|
|||
| 25 | ); |
||
| 26 | } |
||
| 27 | |||
| 28 | return $response; |
||
| 29 | } |
||
| 30 | |||
| 32 |
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: