Passed
Push — main ( 106d28...df360d )
by PRATIK
13:25
created

WebsiteAnalyticsDashboard::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 0

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 0
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 2
rs 10
1
<?php
2
3
namespace Adminetic\Website\View\Components;
4
5
use Analytics;
0 ignored issues
show
Bug introduced by
The type Analytics was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
6
use Spatie\Analytics\Period;
7
use Illuminate\View\Component;
8
9
class WebsiteAnalyticsDashboard extends Component
10
{
11
    /**
12
     * Create a new component instance.
13
     *
14
     * @return void
15
     */
16
    public function __construct()
17
    {
18
        //
19
    }
20
21
    /**
22
     * Get the view / contents that represent the component.
23
     *
24
     * @return \Illuminate\Contracts\View\View|\Closure|string
25
     */
26
    public function render()
27
    {
28
        $top_keywords = Analytics::performQuery(
29
            Period::days(request()->has('days') ? (int) request()->days : 7),
30
            'ga:keyword',
31
            [
32
                'dimensions' => 'ga:keyword',
33
                'metrics' => 'ga:sessions',
34
                'sort' => '-ga:sessions'
35
            ]
36
        )->rows;
37
38
        return view('website::components.website-analytics-dashboard', compact('top_keywords'));
39
    }
40
}
41