| Conditions | 2 |
| Paths | 2 |
| Total Lines | 18 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 12 | public function index() |
||
| 13 | { |
||
| 14 | $logItems = $this->getLatestActivityItems(); |
||
| 15 | |||
| 16 | $view = view('back.dashboard.index')->with(compact('logItems')); |
||
|
|
|||
| 17 | |||
| 18 | if (empty(config('laravel-analytics.view_id'))) { |
||
| 19 | return $view; |
||
| 20 | } |
||
| 21 | |||
| 22 | $analyticsData = Analytics::fetchTotalVisitorsAndPageViews(Period::days(14)); |
||
| 23 | |||
| 24 | $dates = $analyticsData->pluck('date'); |
||
| 25 | $visitors = $analyticsData->pluck('visitors'); |
||
| 26 | $pageViews = $analyticsData->pluck('pageViews'); |
||
| 27 | |||
| 28 | return $view->with(compact('dates', 'visitors', 'pageViews')); |
||
| 29 | } |
||
| 30 | |||
| 39 |
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: