コード例 #1
0
 /**
  * Salesmachine_QueueConsumer constructor.
  * Store our secret and options as part of this consumer
  *
  * @param $token
  * @param string $secret
  * @param array $options
  */
 public function __construct($token, $secret, $options = array())
 {
     parent::__construct($token, $secret, $options);
     if (isset($options["max_queue_size"])) {
         $this->max_queue_size = $options["max_queue_size"];
     }
     if (isset($options["batch_size"])) {
         $this->batch_size = $options["batch_size"];
     }
     $this->queue = array();
 }
コード例 #2
0
ファイル: File.php プロジェクト: AlexLombry/salesmachine-php
 /**
  * Salesmachine_Consumer_File constructor.
  * The file consumer writes track and identify calls to a file.
  *
  * @param $token
  * @param $secret
  * @param array $endpoint
  * @param array $options
  */
 public function __construct($token, $secret, $endpoint, $options = array())
 {
     if (!isset($options["filename"])) {
         $options["filename"] = sys_get_temp_dir() . DIRECTORY_SEPARATOR . "analytics.log";
     }
     parent::__construct($secret, $options);
     try {
         $this->file_handle = fopen($options["filename"], "a");
         chmod($options["filename"], 0777);
     } catch (Exception $e) {
         $this->handleError($e->getCode(), $e->getMessage());
     }
 }