Skip to content

Commit c043a1d

Browse files
committed
Merge branch 'dev'
2 parents 04f6a11 + 2e7844d commit c043a1d

3 files changed

Lines changed: 6 additions & 9 deletions

File tree

src/EventManager.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,7 @@ public function buildEvent(EventOptions $opts)
4545
$reqCtx = new RequestContext($cid, $vid, $fp, $ip, $remoteIp, $method, $url, $headers);
4646

4747
$properties = $opts->properties;
48-
$timestamp = null;
49-
try {
50-
$timestamp = $opts->timestamp ? $opts->timestamp : (new DateTime("now", new DateTimeZone("UTC")))->format(DateTime::ISO8601);
51-
} catch (\Exception $e) {}
48+
$timestamp = $opts->timestamp ? $opts->timestamp : date('Y-m-d\TH:i:s.Z\Z', time());
5249

5350
$event = new SecurenativeEvent($rid, $eventType, $userId, $userTraits, $reqCtx, $properties, $timestamp);
5451

src/Models/EventOptions.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ private function set($data){
4343
$this->userTraits = new UserTraits(
4444
isset($userTraits[self::EVENT_USER_TRAITS_NAME]) ? $userTraits[self::EVENT_USER_TRAITS_NAME] : '',
4545
isset($userTraits[self::EVENT_USER_TRAITS_EMAIL]) ? $userTraits[self::EVENT_USER_TRAITS_EMAIL] : '',
46-
isset($userTraits[self::EVENT_USER_TRAITS_CREATED_AT]) ? $userTraits[self::EVENT_USER_TRAITS_CREATED_AT] : ''
46+
isset($userTraits[self::EVENT_USER_TRAITS_CREATED_AT]) ? $userTraits[self::EVENT_USER_TRAITS_CREATED_AT] : null
4747
);
4848
}
4949

@@ -60,11 +60,11 @@ private function set($data){
6060
}
6161

6262

63-
if (count($data[self::EVENT_PROPERTIES]) > self::MAX_EVENT_PROPERTIES_COUNT) {
63+
if (isset($data[self::EVENT_PROPERTIES]) && count($data[self::EVENT_PROPERTIES]) > self::MAX_EVENT_PROPERTIES_COUNT) {
6464
throw new \Exception('You can only set up to ' . self::MAX_EVENT_PROPERTIES_COUNT . ' custom properties');
6565
}
6666

67-
$this->properties = isset($data[self::EVENT_PROPERTIES]) ? $data[self::EVENT_PROPERTIES] : null;
67+
$this->properties = isset($data[self::EVENT_PROPERTIES]) && count($data[self::EVENT_PROPERTIES]) > 0 ? $data[self::EVENT_PROPERTIES] : null;
6868
$this->timestamp = isset($data[self::EVENT_TIMESTAMP]) ? $data[self::EVENT_TIMESTAMP] : null;
6969
}
7070
}

src/Models/SecurenativeEvent.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ class SecurenativeEvent
99
public $userId;
1010
public $userTraits;
1111
public $request;
12-
public $properties = array();
12+
public $properties;
1313
public $timestamp;
1414

1515
/**
@@ -22,7 +22,7 @@ class SecurenativeEvent
2222
* @param array $properties
2323
* @param $timestamp
2424
*/
25-
public function __construct($rid, $eventType, $userId, $userTraits, $request, array $properties, $timestamp)
25+
public function __construct($rid, $eventType, $userId, $userTraits, $request, $properties, $timestamp)
2626
{
2727
$this->rid = $rid;
2828
$this->eventType = $eventType;

0 commit comments

Comments
 (0)