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