@@ -10,20 +10,23 @@ if (in_array('--help', $argv)) {
10
10
11
11
date_default_timezone_set ('UTC ' );
12
12
13
- $ options = getopt ('' , [
13
+ $ options = getopt ('' , array (
14
14
'writeKey:: ' ,
15
- 'type: ' , // T I P G A
16
- 'event:: ' , // x
17
- 'userId:: ' , // x x x x x
18
- 'groupId:: ' , // x
19
- 'previousId:: ' , // x
20
- 'anonymousId:: ' , // x x x x x
21
- 'properties:: ' , // x x
22
- 'name:: ' , // x
23
- 'traits:: ' , // x x
24
- 'context:: ' , // x x x x x
25
- 'timestamp:: ' // x x x x x
26
- ]);
15
+ 'type: ' ,
16
+
17
+ 'userId:: ' ,
18
+
19
+ 'event:: ' ,
20
+ 'properties:: ' ,
21
+
22
+ 'name:: ' ,
23
+
24
+ 'traits:: ' ,
25
+
26
+ 'groupId:: ' ,
27
+
28
+ 'previousId:: '
29
+ ));
27
30
28
31
if (empty ($ options ['writeKey ' ])) {
29
32
error ('writeKey flag required ' );
@@ -35,44 +38,31 @@ switch ($options['type']) {
35
38
case 'track ' :
36
39
Segment::track (array (
37
40
'userId ' => $ options ['userId ' ],
38
- 'anonymousId ' => $ options ['anonymousId ' ],
39
41
'event ' => $ options ['event ' ],
40
- 'properties ' => parse_json ($ options ['properties ' ]),
41
- 'timestamp ' => parse_timestamp ($ options ['timestamp ' ]),
42
- 'context ' => parse_json ($ options ['context ' ])
42
+ 'properties ' => parse_json ($ options ['properties ' ])
43
43
));
44
44
break ;
45
45
46
46
case 'identify ' :
47
47
Segment::identify (array (
48
48
'userId ' => $ options ['userId ' ],
49
- 'anonymousId ' => $ options ['anonymousId ' ],
50
- 'traits ' => parse_json ($ options ['traits ' ]),
51
- 'timestamp ' => parse_timestamp ($ options ['timestamp ' ]),
52
- 'context ' => parse_json ($ options ['context ' ])
49
+ 'traits ' => parse_json ($ options ['traits ' ])
53
50
));
54
51
break ;
55
52
56
53
case 'page ' :
57
54
Segment::page (array (
58
55
'userId ' => $ options ['userId ' ],
59
- 'anonymousId ' => $ options ['anonymousId ' ],
60
56
'name ' => $ options ['name ' ],
61
- 'category ' => $ options ['category ' ],
62
- 'properties ' => parse_json ($ options ['properties ' ]),
63
- 'timestamp ' => parse_timestamp ($ options ['timestamp ' ]),
64
- 'context ' => parse_json ($ options ['context ' ])
57
+ 'properties ' => parse_json ($ options ['properties ' ])
65
58
));
66
59
break ;
67
60
68
61
case 'group ' :
69
62
Segment::identify (array (
70
63
'userId ' => $ options ['userId ' ],
71
- 'anonymousId ' => $ options ['anonymousId ' ],
72
64
'groupId ' => $ options ['groupId ' ],
73
- 'traits ' => parse_json ($ options ['traits ' ]),
74
- 'timestamp ' => parse_timestamp ($ options ['timestamp ' ]),
75
- 'context ' => parse_json ($ options ['context ' ])
65
+ 'traits ' => parse_json ($ options ['traits ' ])
76
66
));
77
67
break ;
78
68
0 commit comments