Campaigns.php
2 years ago
Cities.php
2 years ago
Countries.php
2 years ago
Current_Traffic_Finder.php
3 years ago
Device_Browsers.php
2 years ago
Device_Operating_Systems.php
2 years ago
Device_Types.php
2 years ago
Referrers.php
2 years ago
Resources.php
2 years ago
Table_Data.php
3 years ago
Visitors_Over_Time_Finder.php
3 years ago
Device_Browsers.php
31 lines
| 1 | <?php |
| 2 | |
| 3 | namespace IAWP_SCOPED\IAWP\Queries; |
| 4 | |
| 5 | use IAWP_SCOPED\IAWP\Models\Device; |
| 6 | use IAWP_SCOPED\IAWP\Query; |
| 7 | use IAWP_SCOPED\IAWP\Statistics\Device_Statistics; |
| 8 | class Device_Browsers extends Table_Data |
| 9 | { |
| 10 | protected function convert_results_to_ids($results) : array |
| 11 | { |
| 12 | return Device::convert_devices_to_ids($results); |
| 13 | } |
| 14 | protected function statistics_class() : string |
| 15 | { |
| 16 | return Device_Statistics::class; |
| 17 | } |
| 18 | protected function query() : array |
| 19 | { |
| 20 | $rows = Query::query('get_device_browsers', ['start' => $this->date_range()->iso_start(), 'end' => $this->date_range()->iso_end(), 'previous_start' => $this->date_range()->previous_period()->iso_start(), 'previous_end' => $this->date_range()->previous_period()->iso_end()])->rows(); |
| 21 | return $this->rows_to_device_types($rows); |
| 22 | } |
| 23 | private function rows_to_device_types($rows) : array |
| 24 | { |
| 25 | return \array_map(function ($row) { |
| 26 | $row->device_ids = \explode(',', $row->device_ids); |
| 27 | return new Device($row); |
| 28 | }, $rows); |
| 29 | } |
| 30 | } |
| 31 |