PHP Класс DataSift_Definition

Автор: Stuart Dallas ([email protected])
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$_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.

Открытые методы

Метод Описание
__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.

Защищенные методы

Метод Описание
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.

Описание методов

__construct() публичный Метод

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() защищенный Метод

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
Результат void

compile() публичный Метод

Call the DataSift API to compile this defintion. On success it will store the returned hash.
public compile ( ) : void
Результат void

createHistoric() публичный Метод

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)
Результат DataSift_Historic

get() публичный Метод

Returns the definition string.
public get ( ) : string
Результат string The definition.

getBuffered() публичный Метод

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.
Результат array

getConsumer() публичный Метод

Returns a DataSift_StreamConsumer-derived object for this definition, for the given type.
См. также: 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
Результат DataSift_StreamConsumer The consumer object.

getCreatedAt() публичный Метод

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
Результат integer The date as a unix timestamp.

getDPUBreakdown() публичный Метод

.. dpu => The breakdown of running the rule total => The total dpu of the rule
public getDPUBreakdown ( ) : array
Результат array

getHash() публичный Метод

Returns the hash for this definition. If the hash has not yet been obtained it compiles the definition first.
public getHash ( ) : string
Результат string The hash.

getTotalDPU() публичный Метод

Returns the total DPU of the stream. If the DPU has not yet been obtained it validates the definition first.
public getTotalDPU ( ) : integer
Результат integer The total DPU.

set() публичный Метод

Sets the definition string.
public set ( string $csdl ) : void
$csdl string The new definition string.
Результат void

validate() публичный Метод

Call the DataSift API to validate this defintion. On success it will store the returned hash.
public validate ( ) : void
Результат void

Описание свойств

$_created_at защищенное свойство

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

$_csdl защищенное свойство

The CSDL source code.
protected $_csdl

$_hash защищенное свойство

The stream hash.
protected $_hash

$_total_dpu защищенное свойство

The total number of DPUs used.
protected $_total_dpu

$_user защищенное свойство

The DataSift User object.
protected $_user