Env::displaySubscriptionDetails PHP Method

displaySubscriptionDetails() public method

Displays details of a Historics query.
public displaySubscriptionDetails ( DataSift_Push_Subscription $sub )
$sub DataSift_Push_Subscription A DataSift Push Subscription object
    public function displaySubscriptionDetails($sub)
    {
        echo 'ID:            ' . $sub->getId() . PHP_EOL;
        echo 'Name:          ' . $sub->getName() . PHP_EOL;
        echo 'Status:        ' . $sub->getStatus() . PHP_EOL;
        echo 'Created at:    ' . (is_null($sub->getCreatedAt()) ? 'null' : date('r', $sub->getCreatedAt())) . PHP_EOL;
        echo 'Last request:  ' . (is_null($sub->getLastRequest()) ? 'null' : date('r', $sub->getLastRequest())) . PHP_EOL;
        echo 'Last success:  ' . (is_null($sub->getLastSuccess()) ? 'null' : date('r', $sub->getLastSuccess())) . PHP_EOL;
        echo 'Output Type:   ' . $sub->getOutputType() . PHP_EOL;
        echo 'Output Params:' . PHP_EOL;
        foreach ($sub->getOutputParams() as $key => $val) {
            echo '  ' . $key . ' = ' . $val . PHP_EOL;
        }
    }

Usage Example

コード例 #1
0
    $push_definition = $env->user->createPushDefinition();
    $push_definition->setOutputType($output_type);
    // Now add the output_type-specific args from the command line
    for ($i = 7; $i < count($env->args); $i++) {
        $bits = explode('=', $env->args[$i], 2);
        if (count($bits) != 2) {
            usage('Invalid output_param: ' . $env->args[$i]);
        }
        $push_definition->setOutputParam($bits[0], $bits[1]);
    }
    // Subscribe the push definition to the historic query
    $push_sub = $push_definition->subscribeHistoric($historic, $name);
    // Start the historic
    $historic->start();
    // Display the details of the new subscription
    $env->displaySubscriptionDetails($push_sub);
} catch (Exception $e) {
    echo 'ERR: ' . get_class($e) . ' ' . $e->getMessage() . PHP_EOL;
}
/**
 * Date string parser.
 *
 * @param string $date Date string.
 */
function parseDate($date)
{
    if (strlen($date) != 14) {
        usage('Invalid date: "' . $date . '"');
    }
    // Expand the date so strtotime can deal with it
    return strtotime(substr($date, 0, 4) . '-' . substr($date, 4, 2) . '-' . substr($date, 6, 2) . ' ' . substr($date, 8, 2) . ':' . substr($date, 10, 2) . ':' . substr($date, 12, 2));
All Usage Examples Of Env::displaySubscriptionDetails