class S5Device extends Device (View source)

Properties

protected string $handle from Device
protected string $name from Device
protected string $brand from Device
protected string $orientation from Device
protected string $agent from Device
protected int $width from Device
protected int $height from Device
protected int $ratio from Device
protected int $type from Device

Methods

__construct(string $handle, string $name, string $brand, string $user_agent, int $width, int $height, int $type, int $ratio = 1)

No description

from Device
string
getHandle()

Get the device handle.

from Device
string
getName()

Get the device name.

from Device
string
getBrand()

Get the device brand.

from Device
string
getUserAgent()

Get the device user agent.

from Device
int
getWidth()

Get the screen width of the device in pixels Be sure to adjust this by the device pixel ratio.

from Device
int
getHeight()

Get the screen height of the device in pixels Be sure to adjust this by the device pixel ratio.

from Device
int
getType()

Get the devices type this is an int that maps to a constant on this class, UNKNOWN MOBILE TABLET or DESKTOP If testing against a device and not against "UNKNOWN", do not test this directly against a device type, instead use bitwise AND to test for the enum you'd like to test:.

from Device
int
getPixelRatio()

Get the device pixel ratio.

from Device
string
getViewportHTML()

Get the HTML for this device's viewport.

string
getIconClass()

Get the class to be used for this device's icon.

from Device
bool
isMobile()

No description

from Device
bool
isTablet()

No description

from Device
bool
isDesktop()

No description

from Device
string
getDefaultOrientation()

Get the device's default orientation.

from Device
static DeviceInterface
configConstructor($handle, array $config)

Construct from given configuration.

from Device

Details

__construct(string $handle, string $name, string $brand, string $user_agent, int $width, int $height, int $type, int $ratio = 1)

Parameters

string $handle A unique handle
string $name A display name
string $brand The brand to show
string $user_agent The device's user agent
int $width The device width in landscape
int $height The device height in landscape
int $type The device type Device::UNKNOWN|Device::MOBILE|Device::TABLET|Device::DESKTOP
int $ratio The device pixel ratio

string getHandle()

Get the device handle.

Return Value

string

string getName()

Get the device name.

Return Value

string

string getBrand()

Get the device brand.

Return Value

string

string getUserAgent()

Get the device user agent.

Return Value

string

int getWidth()

Get the screen width of the device in pixels Be sure to adjust this by the device pixel ratio.

Return Value

int

int getHeight()

Get the screen height of the device in pixels Be sure to adjust this by the device pixel ratio.

Return Value

int

int getType()

Get the devices type this is an int that maps to a constant on this class, UNKNOWN MOBILE TABLET or DESKTOP If testing against a device and not against "UNKNOWN", do not test this directly against a device type, instead use bitwise AND to test for the enum you'd like to test:.

// Check if the type is known, if so is it mobile? if ($device->getType() == Device::UNKNOWN) { $is_mobile = !!($device->getPixelRatio() & Device::MOBILE); }

http://php.net/manual/en/language.operators.bitwise.php

Return Value

int

int getPixelRatio()

Get the device pixel ratio.

Return Value

int

string getViewportHTML()

Get the HTML for this device's viewport.

Return Value

string

string getIconClass()

Get the class to be used for this device's icon.

Return Value

string

bool isMobile()

Return Value

bool

bool isTablet()

Return Value

bool

bool isDesktop()

Return Value

bool

string getDefaultOrientation()

Get the device's default orientation.

Return Value

string ["landscape"|"portrait"]

static DeviceInterface configConstructor($handle, array $config)

Construct from given configuration.

Parameters

$handle
array $config

Return Value

DeviceInterface