The manager is used to instantiate an instance of the wurflDevice class. It can be created in a number of ways:
Both getInstanceByUserAgent() and getInstanceByWurflID call getInstance() internally and load by deviceID. This is for performance reasons (it is faster to index by integer than string). UserAgent lookups attempt to match first by the entire string, then failing that the string is recursed until either it hits the minimum limit (4 characters) or a partial match is made.
These methods only ever return 1 device - even on failure an empty device is still returned.
// get by user agent
$oDevice = wurflManager::getInstanceByUserAgent($_SERVER['HTTP_USER_AGENT']);
$oDevice->getCapabilities()->getCapability('model_name');
// get by wurflID
$oDevice = wurflManager::getInstanceByWurflID('sonyericsson_w880i_ver1');
$oDevice->getCapabilities()->getCapability('model_name');
For ease of use a "stub" method is included that will attempt to return just the stub of the user agent. This is usually the part before the first / e.g. SonyEricssonW880i/R3HJ .... will return SonyEricssonW880i. In the case of Mozilla, Vodafone and some LG, either the entire string is returned, or the first two components, e.g. Vodafone/MOT-Z3/04.32.12 returns Vodafone/MOT-Z3.
private __construct()
public static getResultSetFromIdList([$inList = array()])
Returns a wurflResultSet built from the supplied array of IDs
public static getInstance($inDeviceID)
Returns an instance of wurflDevice, if not found wurflDevice is empty object
public static getInstanceByUserAgent($inUserAgent)
Returns an instance of wurflDevice by userAgent
public static getInstanceByWurflID($inWurflID)
Returns an instance of wurflDevice by WurflID
public static getUserAgentStub($inString)
Attempts to create a "stub" from the userAgent string, always returns a string
public static getUserAgentIterations()
Returns the number of iterations to match the last device
Posted by: Scorpio Documentor (Writer), in Wurfl on 19 Nov 2009 @ 20:39
Tags: wurfl, wurflmanager,
This
work is licenced under a
Creative Commons Licence.