WURFL
[ class tree: WURFL ] [ index: WURFL ] [ all elements ]

Class: WURFL_CustomDevice

Source Location: /CustomDevice.php

Class Overview


WURFL Custom Device - this is the core class that is used by developers to access the properties and capabilities of a mobile device


Author(s):

Methods



Class Details

[line 44]
WURFL Custom Device - this is the core class that is used by developers to access the properties and capabilities of a mobile device

Examples:

  1.  // Create a WURFL Manager and detect device first
  2.  $wurflManagerFactory new WURFL_WURFLManagerFactory($wurflConfig);
  3.  $wurflManager $wurflManagerFactory->create();
  4.  $device $wurflManager->getDeviceForHttpRequest($_SERVER);
  5.  
  6.  // Example 1: Get display resolution from device
  7.  $width $device->getCapability('resolution_width');
  8.  $height $device->getCapability('resolution_height');
  9.  echo "Resolution: $width x $height <br/>";
  10.  
  11.  // Example 2: Get the WURFL ID of the device
  12.  $wurflID $device->id;




Tags:

property-read:  string $id: WURFL Device ID
property-read:  string $userAgent: User Agent
property-read:  string $fallBack: Fallback Device ID
property-read:  bool $actualDeviceRoot: true if device is an actual root device


[ Top ]


Class Methods


constructor __construct [line 66]

WURFL_CustomDevice __construct( Array $modelDevices, [WURFL_Request_GenericRequest $request = null])



Tags:

throws:  InvalidArgumentException if $modelDevices is not an array of at least one WURFL_Xml_ModelDevice
access:  public


Parameters:

array   $modelDevices   Array of WURFL_Xml_ModelDevice objects
WURFL_Request_GenericRequest   $request  

[ Top ]

method getActualDeviceRootAncestor [line 146]

WURFL_Xml_ModelDevice getActualDeviceRootAncestor( )

Returns the nearest actual device root in the fall back tree. If this device is a device root itself, it is returned. Some devices have no device roots in their fall back tree, like generic_android, since no devices above it (itself included) are real devices (actual device roots).



Tags:

access:  public


[ Top ]

method getAllCapabilities [line 184]

array getAllCapabilities( )

Returns capabilities and their values for the current device



Tags:

return:  Device capabilities array
see:  WURFL_Xml_ModelDevice::getCapabilities()
access:  public


[ Top ]

method getAllVirtualCapabilities [line 196]

void getAllVirtualCapabilities( )



Tags:

access:  public


[ Top ]

method getCapability [line 122]

string getCapability( string $capabilityName)

Returns the value of a given capability name for the current device



Tags:

return:  Capability value
see:  WURFL_Xml_ModelDevice::getCapability()
throws:  InvalidArgumentException The $capabilityName is is not defined in the loaded WURFL.
access:  public


Parameters:

string   $capabilityName   must be a valid capability name

[ Top ]

method getFallBackDevices [line 167]

array getFallBackDevices( )

Returns an array with all the fall back devices, from the matched device to the root device ('generic')



Tags:

access:  public


[ Top ]

method getMatchInfo [line 159]

WURFL_Request_MatchInfo getMatchInfo( )

Returns the match info for this device



Tags:

access:  public


[ Top ]

method getRootDevice [line 175]

WURFL_Xml_ModelDevice getRootDevice( )

Returns the top-most device. This is the "generic" device.



Tags:

access:  public


[ Top ]

method getVirtualCapability [line 192]

void getVirtualCapability( $name)



Tags:

access:  public


Parameters:

   $name  

[ Top ]

method isSpecific [line 104]

bool isSpecific( )

Device is a specific or actual WURFL device as defined by its capabilities



Tags:

access:  public


[ Top ]

method __get [line 86]

string __get( string $name)

Magic Method



Tags:

access:  public


Parameters:

string   $name  

[ Top ]


Documentation generated on Thu, 03 Oct 2013 19:11:48 +0000 by phpDocumentor 1.4.4