1 | <?php |
||
10 | class AnalyticsClient |
||
11 | { |
||
12 | /** @var \Google_Service_Analytics */ |
||
13 | protected $service; |
||
14 | |||
15 | /** @var \Illuminate\Contracts\Cache\Repository */ |
||
16 | protected $cache; |
||
17 | |||
18 | /** @var int */ |
||
19 | protected $cacheLifeTimeInMinutes = 0; |
||
20 | |||
21 | public function __construct(Google_Service_Analytics $service, Repository $cache) |
||
27 | |||
28 | /** |
||
29 | * Set the cache time. |
||
30 | * |
||
31 | * @param int $cacheLifeTimeInMinutes |
||
32 | * |
||
33 | * @return self |
||
34 | */ |
||
35 | public function setCacheLifeTimeInMinutes(int $cacheLifeTimeInMinutes) |
||
41 | |||
42 | /** |
||
43 | * Query the Google Analytics Service with given parameters. |
||
44 | * |
||
45 | * @param string $viewId |
||
46 | * @param \DateTime $startDate |
||
47 | * @param \DateTime $endDate |
||
48 | * @param string $metrics |
||
49 | * @param array $others |
||
50 | * |
||
51 | * @return array|null |
||
52 | */ |
||
53 | public function performQuery(string $viewId, DateTime $startDate, DateTime $endDate, string $metrics, array $others = []) |
||
85 | |||
86 | public function getAnalyticsService(): Google_Service_Analytics |
||
90 | |||
91 | /* |
||
92 | * Determine the cache name for the set of query properties given. |
||
93 | */ |
||
94 | protected function determineCacheName(array $properties): string |
||
98 | } |
||
99 |