WhichBrowser\Model\Device::reset PHP Method

reset() public method

Set the properties to the default values
public reset ( array | null $properties = null )
$properties array | null An optional array of properties to set after setting it to the default values
    public function reset($properties = null)
    {
        unset($this->manufacturer);
        unset($this->model);
        unset($this->series);
        unset($this->carrier);
        unset($this->identifier);
        $this->type = '';
        $this->subtype = '';
        $this->identified = Constants\Id::NONE;
        $this->generic = true;
        $this->hidden = false;
        if (is_array($properties)) {
            $this->set($properties);
        }
    }

Usage Example

Example #1
0
 public function testDetected()
 {
     $device = new Device();
     $this->assertFalse($device->isDetected());
     $device->set(['manufacturer' => 'Microsoft', 'model' => 'Xbox One']);
     $this->assertTrue($device->isDetected());
     $device->reset();
     $this->assertFalse($device->isDetected());
     $device->set(['model' => 'Xbox One']);
     $this->assertTrue($device->isDetected());
     $device->set(['manufacturer' => 'Microsoft']);
     $this->assertTrue($device->isDetected());
 }