Browscap\Data\DataCollection::getDevice PHP Метод

getDevice() публичный Метод

Get a single engine data array
public getDevice ( string $device ) : Device
$device string
Результат Device
    public function getDevice($device)
    {
        if (!array_key_exists($device, $this->devices)) {
            throw new \OutOfBoundsException('Device "' . $device . '" does not exist in data, available devices: ' . serialize(array_keys($this->devices)));
        }
        return $this->devices[$device];
    }

Usage Example

Пример #1
0
 /**
  * @expectedException \OutOfBoundsException
  * @expectedExceptionMessage Device "NotExists" does not exist in data, available devices:
  *
  * @group data
  * @group sourcetest
  */
 public function testGetDeviceThrowsExceptionIfDeviceDoesNotExist()
 {
     $this->object->addDevicesFile($this->getDevicesJsonFixture());
     $this->object->getDevice('NotExists');
 }