PHP Class DataSift_Definition

Author: Stuart Dallas ([email protected])
Afficher le fichier Open project: datasift/datasift-php Class Usage Examples

Protected Properties

Свойство Type Description
$_created_at The hash creation time as a UNIX timestamp.
$_csdl The CSDL source code.
$_hash The stream hash.
$_total_dpu The total number of DPUs used.
$_user The DataSift User object.

Méthodes publiques

Méthode Description
__construct ( DataSift_User $user, string $csdl = '', string $hash = false ) Constructor. A DataSift_User object is required, and you can optionally supply a default definition string.
compile ( ) : void Call the DataSift API to compile this defintion. On success it will store the returned hash.
createHistoric ( integer $start, integer $end, array $sources, string $name, float $sample = DataSift_Historic::DEFAULT_SAMPLE ) : DataSift_Historic Create a historic based on this CSDL.
get ( ) : string Returns the definition string.
getBuffered ( integer $count = false, integer $from_id = false ) : array Call the DataSift API to get buffered interactions.
getConsumer ( string $type, DataSift_IStreamConsumerEventHandler $eventHandler ) : DataSift_StreamConsumer Returns a DataSift_StreamConsumer-derived object for this definition, for the given type.
getCreatedAt ( ) : integer Returns the date when the stream was first created. If the created at date has not yet been obtained it validates the definition first.
getDPUBreakdown ( ) : array Call the DataSift API to get the DPU for this definition. Returns an array containing.
getHash ( ) : string Returns the hash for this definition. If the hash has not yet been obtained it compiles the definition first.
getTotalDPU ( ) : integer Returns the total DPU of the stream. If the DPU has not yet been obtained it validates the definition first.
set ( string $csdl ) : void Sets the definition string.
validate ( ) : void Call the DataSift API to validate this defintion. On success it will store the returned hash.

Méthodes protégées

Méthode Description
clearHash ( ) : void Reset the hash to false. The effect of this is to mark the definition as requiring compilation. Also resets other variables that depend on the CSDL.

Method Details

__construct() public méthode

Constructor. A DataSift_User object is required, and you can optionally supply a default definition string.
public __construct ( DataSift_User $user, string $csdl = '', string $hash = false )
$user DataSift_User The user object.
$csdl string An optional default definition string.
$hash string An optional hash for the passed definition.

clearHash() protected méthode

Reset the hash to false. The effect of this is to mark the definition as requiring compilation. Also resets other variables that depend on the CSDL.
protected clearHash ( ) : void
Résultat void

compile() public méthode

Call the DataSift API to compile this defintion. On success it will store the returned hash.
public compile ( ) : void
Résultat void

createHistoric() public méthode

Create a historic based on this CSDL.
public createHistoric ( integer $start, integer $end, array $sources, string $name, float $sample = DataSift_Historic::DEFAULT_SAMPLE ) : DataSift_Historic
$start integer The timestamp from which to start the query.
$end integer The timestamp at which to end the query.
$sources array An array of sources required.
$name string An optional name for this historic.
$sample float Sample size (10 or 100)
Résultat DataSift_Historic

get() public méthode

Returns the definition string.
public get ( ) : string
Résultat string The definition.

getBuffered() public méthode

Call the DataSift API to get buffered interactions.
public getBuffered ( integer $count = false, integer $from_id = false ) : array
$count integer Optional number of interactions to return (max 200).
$from_id integer Optional start ID.
Résultat array

getConsumer() public méthode

Returns a DataSift_StreamConsumer-derived object for this definition, for the given type.
See also: DataSift_StreamConsumer
public getConsumer ( string $type, DataSift_IStreamConsumerEventHandler $eventHandler ) : DataSift_StreamConsumer
$type string The consumer type for which to construct a consumer.
$eventHandler DataSift_IStreamConsumerEventHandler An instance of DataSift_IStreamConsumerEventHandler
Résultat DataSift_StreamConsumer The consumer object.

getCreatedAt() public méthode

Returns the date when the stream was first created. If the created at date has not yet been obtained it validates the definition first.
public getCreatedAt ( ) : integer
Résultat integer The date as a unix timestamp.

getDPUBreakdown() public méthode

.. dpu => The breakdown of running the rule total => The total dpu of the rule
public getDPUBreakdown ( ) : array
Résultat array

getHash() public méthode

Returns the hash for this definition. If the hash has not yet been obtained it compiles the definition first.
public getHash ( ) : string
Résultat string The hash.

getTotalDPU() public méthode

Returns the total DPU of the stream. If the DPU has not yet been obtained it validates the definition first.
public getTotalDPU ( ) : integer
Résultat integer The total DPU.

set() public méthode

Sets the definition string.
public set ( string $csdl ) : void
$csdl string The new definition string.
Résultat void

validate() public méthode

Call the DataSift API to validate this defintion. On success it will store the returned hash.
public validate ( ) : void
Résultat void

Property Details

$_created_at protected_oe property

The hash creation time as a UNIX timestamp.
protected $_created_at

$_csdl protected_oe property

The CSDL source code.
protected $_csdl

$_hash protected_oe property

The stream hash.
protected $_hash

$_total_dpu protected_oe property

The total number of DPUs used.
protected $_total_dpu

$_user protected_oe property

The DataSift User object.
protected $_user