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

Quick Start

The Zend_Http_UserAgent_Device interface defines the following methods.

<?php
interface Zend_Http_UserAgent_Device extends Serializable
{
    public function 
__construct($userAgent null, array $server = array(), array $config = array());
    public static function 
match($userAgent$server);
    public function 
getAllFeatures();
    public function 
getAllGroups();
    public function 
getBrowser();
    public function 
getBrowserVersion();
    public function 
getGroup($group);
    public function 
getImageFormatSupport();
    public function 
getImages();
    public function 
getMaxImageHeight();
    public function 
getMaxImageWidth();
    public function 
getPhysicalScreenHeight();
    public function 
getPhysicalScreenWidth();
    public function 
getPreferredMarkup();
    public function 
getUserAgent();
    public function 
getXhtmlSupportLevel();
    public function 
hasFlashSupport();
    public function 
hasPdfSupport();
    public function 
hasPhoneNumber();
    public function 
httpsSupport();
}

The static function match() should be used to determine whether the provided User-Agent and environment (represented by the $server variable) match this device. If they do, the Zend_Http_UserAgent class will then create an instance of the class, passing it the User-Agent, $server array, and any configuration available; at this time, it is expected that the Device class will consult with a features adapter, if present, and populate itself with discovered capabilities.

In practice, you will likely extend Zend_Http_UserAgent_AbstractDevice, which provides functionality around discovering capabilities from the User-Agent string itself, as well as discovering and querying a Features adapter.

Zend Framework