PhpRiot
Become Zend Certified

Prepare for the ZCE exam using our quizzes (web or iPad/iPhone). More info...


When you're ready get 7.5% off your exam voucher using voucher CJQNOV23 at the Zend Store

Available Methods

__construct($options = null);

The constructor attempts to determine the current User-Agent based on the options provided, the current request information, and/or previously discovered information persisted in storage. Once instantiated, the detected device is immediately available.

Please see configuration options section for details on the $options array.

serialize();

Defined by the Serializable interface, this method performs logic necessary to determine what within the object should be serialized when the object is serialized by a storage adapter.

unserialize($serialized);

Defined by the Serializable interface, this method performs logic necessary to determine how to unserialize a previously serialized instance.

setOptions($options);

Initializes object state. Please see the configuration options section for information on the $options array.

getUserAgent();

Retrieve the discovered User-Agent string. Unless set explicitly, this will be autodiscovered from the server array.

setUserAgent($userAgent);

Set the User-Agent string explicitly. Once getDevice() has been called, this property is marked immutable, and calling this method will raise an exception.

getHttpAccept($httpAccept = null);

Retrieve the HTTP Accept header value.

setHttpAccept($httpAccept);

Explicitly set the HTTP Accept header value. Once getDevice() has been called, this property is marked immutable, and calling this method will raise an exception.

getStorage($browser = null);

Retrieves a persistent storage object for a given browser type.

setStorage(Zend_Http_UserAgent_Storage $storage);

Use this to explicitly set the peristent storage object. Once getDevice() has been called, the storage is marked immutable (as in: you may not inject a new storage object), and calling this method will raise an exception.

clearStorage($browser = null);

Clears any information in the persistent storage object.

getConfig();

Retrieve configuration parameters.

getDevice();

Use this method to get the User-Agent Device object; this is the object that will contain the various discovered device capabilities.

Discovery of the User-Agent device occurs in this method. Once the device has been retrieved, the server array, browser type, user agent, http accept, and storage properties are marked as immutable.

getBrowserType();

Retrieve the discovered browser type; usually one of:

  • Bot

  • Checker

  • Console

  • Desktop

  • Email

  • Feed

  • Mobile

  • Offline

  • Probe

  • Spam

  • Text

  • Validator

Unless explicitly set, the browser type is unknown until getDevice() has been called.

setBrowserType($browserType);

Explicitly set the browser type to prepend to the identification sequence. Once getDevice() has been called, the browser type is marked immutable, and calling this method will raise an exception.

getServer();

Retrieve the array of HTTP headers and environment variables used to perform device discovery. If the array has not yet been set, it is seeded with the $_SERVER superglobal.

setServer($server);

Explicitly set the "server" array of HTTP headers and environment variables to use during device discovery. Once getDevice() has been called, the server array is marked immutable, and calling this method will raise an exception.

getServerValue($key);

Retrieve a single value from the server array by key.

setServerValue($key, $value);

Overwrite or define a value in the internal server array. Once getDevice() has been called, the server array is marked immutable, and calling this method will raise an exception.

setPluginLoader($type, $loader);

$type may be one of "device" or "storage; the former is used when attempting to find device classes, the latter for finding storage classes. $loader may be a Zend_Loader_PluginLoader instance, or a string name containing the classname of a Zend_Loader_PluginLoader extension class.

getPluginLoader($type);

Retrieves either the "device" or "storage" plugin loader instance.

Zend Framework