WhichBrowser\Model\Device::setIdentification PHP Method

setIdentification() public method

Declare an positive identification
public setIdentification ( array $properties ) : string
$properties array An array, the key of an element determines the name of the property
return string
    public function setIdentification($properties)
    {
        $this->reset($properties);
        if (!empty($this->model)) {
            $this->generic = false;
        }
        $this->identified |= Constants\Id::MATCH_UA;
    }

Usage Example

Example #1
0
 public function testToArray()
 {
     $device = new Device();
     $this->assertEquals([], $device->toArray());
     $device->setIdentification(['manufacturer' => 'Sony', 'model' => 'Playstation 4', 'type' => Constants\DeviceType::GAMING, 'subtype' => Constants\DeviceSubType::CONSOLE]);
     $this->assertEquals(['manufacturer' => 'Sony', 'model' => 'Playstation 4', 'type' => Constants\DeviceType::GAMING, 'subtype' => Constants\DeviceSubType::CONSOLE], $device->toArray());
     $device->setIdentification(['manufacturer' => 'NEC', 'model' => 'N2002', 'carrier' => 'DoCoMo', 'type' => Constants\DeviceType::MOBILE, 'subtype' => Constants\DeviceSubType::FEATURE]);
     $this->assertEquals(['manufacturer' => 'NEC', 'model' => 'N2002', 'carrier' => 'DoCoMo', 'type' => Constants\DeviceType::MOBILE, 'subtype' => Constants\DeviceSubType::FEATURE], $device->toArray());
 }