Env::displayHistoricDetails PHP Method

displayHistoricDetails() public method

Displays details of a Historics query.
public displayHistoricDetails ( DataSift_Historic $hist )
$hist DataSift_Historic A DataSift Historics object
    public function displayHistoricDetails($hist)
    {
        echo 'Playback ID: ' . $hist->getHash() . PHP_EOL;
        echo 'Stream hash: ' . $hist->getStreamHash() . PHP_EOL;
        echo 'Name:        ' . $hist->getName() . PHP_EOL;
        echo 'Start time:  ' . date('r', $hist->getStartDate()) . PHP_EOL;
        echo 'End time:    ' . date('r', $hist->getEndDate()) . PHP_EOL;
        $sources = $hist->getSources();
        echo 'Source' . (count($sources) == 1 ? ': ' : 's:') . '     ' . implode(', ', $sources) . PHP_EOL;
        echo 'Sample:      ' . $hist->getSample() . PHP_EOL;
        echo 'Created at:  ' . (is_null($hist->getCreatedAt()) ? 'null' : date('r', $hist->getCreatedAt())) . PHP_EOL;
        echo 'Status:      ' . $hist->getStatus() . PHP_EOL;
    }

Usage Example

コード例 #1
0
ファイル: view.php プロジェクト: datasift/datasift-php
 * @copyright 2011 MediaSift Ltd.
 * @license   http://www.debian.org/misc/bsd.license BSD License (3 Clause)
 * @link      http://www.mediasift.com
 */
/**
 * This script views Historics queries in your account.
 *
 * NB: Most of the error handling (exception catching) has been removed for
 * the sake of simplicity. Nearly everything in this library may throw
 * exceptions, and production code should catch them. See the documentation
 * for full details.
 */
// Include the shared convenience class
require dirname(__FILE__) . '/env.php';
// Create the env object. This reads the command line arguments, creates the
// user object, and provides access to both along with helper functions
$env = new Env();
// Make sure we have at least one playback ID
if (count($env->args) == 0) {
    die('Please specify at least one playback ID!' . PHP_EOL);
}
// Cycle through the IDs passed on the command line
foreach ($env->args as $playback_id) {
    try {
        $hist = $env->user->getHistoric($playback_id);
        $env->displayHistoricDetails($hist);
    } catch (Exception $e) {
        echo get_class($e) . ' ' . $e->getMessage() . PHP_EOL;
    }
    echo '--' . PHP_EOL;
}
All Usage Examples Of Env::displayHistoricDetails