/** * Instantiates a new SyneriseTracker instance. * @param array $config */ public function __construct($config = array(), $logger = null) { if (isset($config['allowFork']) && $config['allowFork'] == true) { $config['handler'] = new ForkCurlHandler(array()); } parent::__construct($config, $logger); $this->client = Producers\Client::getInstance(); $this->event = Producers\Event::getInstance(); $this->transaction = Producers\Transaction::getInstance(); }
/** * Instantiates a new SyneriseTracker instance. * @param array $config */ public function __construct($config = array()) { if (isset($config['allowFork']) && $config['allowFork'] == true) { $config['handler'] = new ForkCurlHandler([]); } parent::__construct($config); $this->client = Producers\Client::getInstance(); $this->event = Event::getInstance(); $this->transaction = Producers\Transaction::getInstance(); $config = Collection::fromConfig($config, static::getDefaultConfig(), static::$required); $this->configure($config); }
/** * Add an array representing a message to be sent to Synerise to a queue. * @param array $message */ public function enqueue($message = array()) { $customIdetify = Client::getInstance()->getCustomIdetify(); if (!empty($customIdetify)) { $message['clientCustomId'] = $customIdetify; } $email = Client::getInstance()->getEmail(); if (!empty($email)) { $message['email'] = $email; } $uuid = Client::getInstance()->getUuid(); if (!empty($uuid)) { $message['uuid'] = $uuid; } if (!isset($message['uuid']) || !$message['uuid']) { $clientUUID = $this->getUuid(); if (!empty($clientUUID)) { $message['uuid'] = $clientUUID; } } $ip = $this->getIp(); if ($ip) { $message['ip'] = $ip; } $ssuid = $this->getSsuid(); if ($ssuid) { $message['ssuid'] = $ssuid; } $userAgent = $this->getUserAgent(); if ($userAgent) { $message['userAgent'] = $userAgent; } $snrsParams = $this->getSnrsParams(); if ($snrsParams) { $message['snr_params'] = $snrsParams; } if (isset($message['params']['time']) && $this->_is_timestamp($message['params']['time'])) { $message['time'] = $message['params']['time'] = $message['params']['time'] * 1000; unset($message['params']['time']); } else { if (isset($message['params']['time'])) { throw new SyneriseException('Parameter `time` have to be in timesamp format.'); } else { $message['time'] = time() * 1000; } } array_push($this->_requestQueue, $message); }