PHP Class Browscap\Data\DataCollection

Author: James Titcumb ([email protected])
Datei anzeigen Open project: browscap/browscap Class Usage Examples

Public Methods

Method Description
__construct ( string $version ) Create a new data collection for the specified version
addDefaultBrowser ( string $src ) : DataCollection Load the file for the default browser
addDefaultProperties ( string $src ) : DataCollection Load the file for the default properties
addDevicesFile ( string $src ) : DataCollection Load a devices.json file and parse it into the platforms data array
addEnginesFile ( string $src ) : DataCollection Load a engines.json file and parse it into the platforms data array
addPlatformsFile ( string $src ) : DataCollection Load a platforms.json file and parse it into the platforms data array
addSourceFile ( string $src ) : DataCollection Load a JSON file, parse it's JSON and add it to our divisions list
checkProperty ( string $key, array $properties ) : boolean
getDefaultBrowser ( ) : Division Get the divisions array containing UA data
getDefaultProperties ( ) : Division Get the divisions array containing UA data
getDevice ( string $device ) : Device Get a single engine data array
getDevices ( ) : Device[] Get the array of engine data
getDivisions ( ) : Division[] Get the divisions array containing UA data
getEngine ( string $engine ) : Engine Get a single engine data array
getEngines ( ) : Engine[] Get the array of engine data
getGenerationDate ( ) : DateTime Get the generation DateTime object
getLogger ( ) : Psr\Log\LoggerInterface
getPlatform ( string $platform ) : Platform Get a single platform data array
getPlatforms ( ) : Platform[] Get the array of platform data
getVersion ( ) : string Get the version string identifier
setLogger ( Psr\Log\LoggerInterface $logger ) : DataCollection
sortDivisions ( ) : DataCollection Sort the divisions (if they haven't already been sorted)

Private Methods

Method Description
checkDeviceData ( array $properties, string $message ) checks if device properties are set inside a properties array
checkEngineData ( array $properties, string $message ) checks if platform properties are set inside a properties array
checkPlatformData ( array $properties, string $message ) checks if platform properties are set inside a properties array
loadFile ( string $src ) : array

Method Details

__construct() public method

Create a new data collection for the specified version
public __construct ( string $version )
$version string

addDefaultBrowser() public method

Load the file for the default browser
public addDefaultBrowser ( string $src ) : DataCollection
$src string Name of the file
return DataCollection

addDefaultProperties() public method

Load the file for the default properties
public addDefaultProperties ( string $src ) : DataCollection
$src string Name of the file
return DataCollection

addDevicesFile() public method

Load a devices.json file and parse it into the platforms data array
public addDevicesFile ( string $src ) : DataCollection
$src string Name of the file
return DataCollection

addEnginesFile() public method

Load a engines.json file and parse it into the platforms data array
public addEnginesFile ( string $src ) : DataCollection
$src string Name of the file
return DataCollection

addPlatformsFile() public method

Load a platforms.json file and parse it into the platforms data array
public addPlatformsFile ( string $src ) : DataCollection
$src string Name of the file
return DataCollection

addSourceFile() public method

Load a JSON file, parse it's JSON and add it to our divisions list
public addSourceFile ( string $src ) : DataCollection
$src string Name of the file
return DataCollection

checkProperty() public method

public checkProperty ( string $key, array $properties ) : boolean
$key string
$properties array
return boolean

getDefaultBrowser() public method

Get the divisions array containing UA data
public getDefaultBrowser ( ) : Division
return Division

getDefaultProperties() public method

Get the divisions array containing UA data
public getDefaultProperties ( ) : Division
return Division

getDevice() public method

Get a single engine data array
public getDevice ( string $device ) : Device
$device string
return Device

getDevices() public method

Get the array of engine data
public getDevices ( ) : Device[]
return Device[]

getDivisions() public method

Get the divisions array containing UA data
public getDivisions ( ) : Division[]
return Division[]

getEngine() public method

Get a single engine data array
public getEngine ( string $engine ) : Engine
$engine string
return Engine

getEngines() public method

Get the array of engine data
public getEngines ( ) : Engine[]
return Engine[]

getGenerationDate() public method

Get the generation DateTime object
public getGenerationDate ( ) : DateTime
return DateTime

getLogger() public method

public getLogger ( ) : Psr\Log\LoggerInterface
return Psr\Log\LoggerInterface $logger

getPlatform() public method

Get a single platform data array
public getPlatform ( string $platform ) : Platform
$platform string
return Platform

getPlatforms() public method

Get the array of platform data
public getPlatforms ( ) : Platform[]
return Platform[]

getVersion() public method

Get the version string identifier
public getVersion ( ) : string
return string

setLogger() public method

public setLogger ( Psr\Log\LoggerInterface $logger ) : DataCollection
$logger Psr\Log\LoggerInterface
return DataCollection

sortDivisions() public method

Sort the divisions (if they haven't already been sorted)
public sortDivisions ( ) : DataCollection
return DataCollection