function testAlias() { $this->assertTrue(Segment::alias(array("previousId" => "previous-id", "userId" => "user-id"))); }
} $payload = json_decode($line, true); $dt = new DateTime($payload["timestamp"]); $ts = floatval($dt->getTimestamp() . "." . $dt->format("u")); $payload["timestamp"] = $ts; $type = $payload["type"]; $ret = call_user_func_array(array('Analytics\\Segmentio\\Segment', $type), array($payload)); if ($ret) { $successful++; } $total++; if ($total % 100 === 0) { Segment::flush(); } } Segment::flush(); unlink($file); /** * Sent */ print "sent {$successful} from {$total} requests successfully"; exit(0); /** * Parse arguments * * @param mixed $argv * * @return array */ function parse($argv) {