PHP Class Xhgui_Profiles, xhgui

ファイルを表示 Open project: perftools/xhgui Class Usage Examples

Protected Properties

Property Type Description
$_collection
$_mapper

Public Methods

Method Description
__construct ( MongoDb $db )
get ( string $id ) : Xhgui_Profile Get a single profile run by id.
getAll ( array $options = [] ) : array Get a paginated set of results.
getAvgsForUrl ( string $url, array $search = [] ) : array Get the Average metrics for a URL
getForUrl ( string $url, array $options, array $conditions = [] ) : MongoCursor Get the list of profiles for a simplified url.
getPercentileForUrl ( integer $percentile, string $url, array $search = [] ) : array Get the Percentile metrics for a URL
insert ( array $profile ) Insert a profile run.
latest ( ) : Xhgui_Profile Get the latest profile data.
paginate ( $options )
query ( $conditions, $fields = null )
truncate ( ) : boolean Used to truncate a collection.

Protected Methods

Method Description
_wrap ( array | MongoCursor $data ) : Xhgui_Profile | array Converts arrays + MongoCursors into Xhgui_Profile instances.

Method Details

__construct() public method

public __construct ( MongoDb $db )
$db MongoDb

_wrap() protected method

Converts arrays + MongoCursors into Xhgui_Profile instances.
protected _wrap ( array | MongoCursor $data ) : Xhgui_Profile | array
$data array | MongoCursor The data to transform.
return Xhgui_Profile | array The transformed/wrapped results.

get() public method

Get a single profile run by id.
public get ( string $id ) : Xhgui_Profile
$id string The id of the profile to get.
return Xhgui_Profile

getAll() public method

Get a paginated set of results.
public getAll ( array $options = [] ) : array
$options array The find options to use.
return array An array of result data.

getAvgsForUrl() public method

This will group data by date and returns only the avg + date, making the data ideal for time series graphs
public getAvgsForUrl ( string $url, array $search = [] ) : array
$url string
$search array Search options containing date_start and or date_end
return array Array of metrics grouped by date

getForUrl() public method

Get the list of profiles for a simplified url.
public getForUrl ( string $url, array $options, array $conditions = [] ) : MongoCursor
$url string The url to load profiles for.
$options array Pagination options to use.
$conditions array The search options.
return MongoCursor

getPercentileForUrl() public method

This will group data by date and returns only the percentile + date, making the data ideal for time series graphs
public getPercentileForUrl ( integer $percentile, string $url, array $search = [] ) : array
$percentile integer The percentile you want. e.g. 90.
$url string
$search array Search options containing date_start and or date_end
return array Array of metrics grouped by date

insert() public method

Does unchecked inserts.
public insert ( array $profile )
$profile array The profile data to save.

latest() public method

Get the latest profile data.
public latest ( ) : Xhgui_Profile
return Xhgui_Profile

paginate() public method

public paginate ( $options )

query() public method

public query ( $conditions, $fields = null )

truncate() public method

Primarly used in test cases to reset the test db.
public truncate ( ) : boolean
return boolean

Property Details

$_collection protected_oe property

protected $_collection

$_mapper protected_oe property

protected $_mapper