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