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 LoggerInterface */ |
||
19 | protected $log; |
||
20 | |||
21 | /** @var int */ |
||
22 | protected $cacheLifeTimeInMinutes = 0; |
||
23 | |||
24 | public function __construct(Google_Service_Analytics $service, Repository $cache, LoggerInterface $log) |
||
32 | |||
33 | /** |
||
34 | * Set the cache time. |
||
35 | * |
||
36 | * @param int $cacheLifeTimeInMinutes |
||
37 | * |
||
38 | * @return self |
||
39 | */ |
||
40 | public function setCacheLifeTimeInMinutes(int $cacheLifeTimeInMinutes) |
||
46 | |||
47 | /** |
||
48 | * Query the Google Analytics Service with given parameters. |
||
49 | * |
||
50 | * @param string $viewId |
||
51 | * @param \DateTime $startDate |
||
52 | * @param \DateTime $endDate |
||
53 | * @param string $metrics |
||
54 | * @param array $others |
||
55 | * |
||
56 | * @return array|null |
||
57 | */ |
||
58 | public function performQuery(string $viewId, DateTime $startDate, DateTime $endDate, string $metrics, array $others = []) |
||
103 | |||
104 | public function getAnalyticsService(): Google_Service_Analytics |
||
108 | |||
109 | /* |
||
110 | * Determine the cache name for the set of query properties given. |
||
111 | */ |
||
112 | protected function determineCacheName(array $properties): string |
||
116 | } |
||
117 |