Ejemplo n.º 1
0
 private function detectArchos($ua)
 {
     /* Generation 4 */
     if (preg_match('/Archos A([67]04)WIFI\\//u', $ua, $match)) {
         $this->data->os->reset();
         $this->data->device->setIdentification(['manufacturer' => 'Archos', 'model' => $match[1] . ' WiFi', 'type' => Constants\DeviceType::MEDIA]);
     }
     /* Generation 5 */
     if (preg_match('/ARCHOS; GOGI; a([67]05f?);/u', $ua, $match)) {
         $this->data->os->reset();
         $this->data->device->setIdentification(['manufacturer' => 'Archos', 'model' => $match[1] . ' WiFi', 'type' => Constants\DeviceType::MEDIA]);
     }
     /* Generation 6 without Android */
     if (preg_match('/ARCHOS; GOGI; G6([SHL]);/u', $ua, $match)) {
         $this->data->os->reset();
         $this->data->device->setIdentification(['manufacturer' => 'Archos', 'type' => Constants\DeviceType::MEDIA]);
         switch ($match[1]) {
             case 'S':
             case 'H':
                 $this->data->device->model = '5';
                 break;
             case 'L':
                 $this->data->device->model = '7';
                 break;
         }
     }
     /* Generation 6 with Android */
     if (preg_match('/ARCHOS; GOGI; A5[SH]; Version ([0-9]\\.[0-9])/u', $ua, $match)) {
         $version = new Version(['value' => $match[1]]);
         $this->data->os->reset(['name' => 'Android', 'version' => new Version(['value' => $version->is('<', '1.7') ? '1.5' : '1.6'])]);
         $this->data->device->setIdentification(['manufacturer' => 'Archos', 'model' => '5', 'type' => Constants\DeviceType::MEDIA]);
     }
 }
Ejemplo n.º 2
0
 public function testToArray()
 {
     $version = new Version();
     $this->assertEquals([], $version->toArray());
     $version->set(['value' => '4.1.1']);
     $this->assertEquals('4.1.1', $version->toArray());
     $version->set(['value' => '4.1.1', 'details' => 2]);
     $this->assertEquals('4.1', $version->toArray());
     $version = new Version();
     $version->set(['value' => '5.1', 'alias' => 'XP']);
     $this->assertEquals(['value' => '5.1', 'alias' => 'XP'], $version->toArray());
     $version = new Version();
     $version->set(['value' => '10.11', 'nickname' => 'El Capitan']);
     $this->assertEquals(['value' => '10.11', 'nickname' => 'El Capitan'], $version->toArray());
 }