Factory function. Creates a StreamConsumer-derived object for the given
type.
public static factory ( string $user, string $type, mixed $definition, string $eventHandler ) : DataSift_StreamConsumer | ||
$user | string | Use DataSift_User object. |
$type | string | Use the TYPE_ constants |
$definition | mixed | CSDL string or a Definition object. |
$eventHandler | string | The object that will receive events. |
return | DataSift_StreamConsumer | The consumer object |
/** * Returns a DataSift_StreamConsumer-derived object for the given hashes, * for the given type. * * @param string $type The consumer type for which to construct a consumer. * @param string $hashes An array containing hashes and/or Definition objects to be consumed. * @param DataSift_IStreamConsumerEventHandler $eventHandler The object that will receive events. * * @return DataSift_StreamConsumer The consumer object. * @throws DataSift_Exception_InvalidData * @see DataSift_StreamConsumer */ public function getMultiConsumer($type = DataSift_StreamConsumer::TYPE_HTTP, $hashes, $eventHandler) { return DataSift_StreamConsumer::factory($this, $type, $hashes, $eventHandler); }
/** * Returns a DataSift_StreamConsumer-derived object for this definition, * for the given type. * * @param string $type The consumer type for which to construct a consumer. * @param DataSift_IStreamConsumerEventHandler $eventHandler An instance of DataSift_IStreamConsumerEventHandler * * @return DataSift_StreamConsumer The consumer object. * @throws DataSift_Exception_InvalidData * @see DataSift_StreamConsumer */ public function getConsumer($type, $eventHandler) { return DataSift_StreamConsumer::factory($this->_user, $type, $this, $eventHandler); }