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]); } }
public function testIs() { $version = new Version(['value' => '40.0.2214']); $this->assertTrue($version->is('=', '40')); $this->assertTrue($version->is('>=', '40')); $this->assertTrue($version->is('<=', '40')); $this->assertTrue($version->is('>', '39')); $this->assertTrue($version->is('<', '41')); $this->assertFalse($version->is('=', '39')); $this->assertFalse($version->is('>=', '41')); $this->assertFalse($version->is('<=', '39')); $this->assertFalse($version->is('>', '40')); $this->assertFalse($version->is('<', '40')); $version = new Version(['value' => '10.11.1']); $this->assertTrue($version->is('=', '10')); $this->assertTrue($version->is('=', '10.11')); $this->assertTrue($version->is('=', '10.11.1')); $this->assertTrue($version->is('=', '10.11.01')); $this->assertTrue($version->is('=', 10)); $this->assertTrue($version->is('=', 10.11)); $this->assertTrue($version->is('>', '10.1')); $this->assertTrue($version->is('>', '10.01')); $this->assertTrue($version->is('>', '10.10')); $this->assertFalse($version->is('>', '10')); $this->assertFalse($version->is('>', '10.11')); }