PluginProbe
Elementor Website Builder – more than just a page builder / 4.3.2
Elementor Website Builder – more than just a page builder v4.3.2
4.3.2 4.3.1 4.3.0 4.3.0-beta3 4.3.0-beta2 4.3.0-beta1 4.2.4 4.2.3 4.2.2 4.2.1 4.2.0 4.1.5 4.2.0-beta2 4.2.0-dev2 4.2.0-beta1 4.1.4 4.1.3 4.1.2 4.1.1 4.1.0 4.1.0-beta3 4.1.0-dev3 4.0.9 4.1.0-beta2 4.1.0-dev2 All 455 releases
elementor / vendor_prefixed / mixpanel / lib / ConsumerStrategies / AbstractConsumer.php

AbstractConsumer.php in Elementor Website Builder – more than just a page builder 4.3.2, at vendor_prefixed/mixpanel/lib/ConsumerStrategies/AbstractConsumer.php

64 lines 1.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace ElementorDeps;
4
5 require_once \dirname(__FILE__) . "/../Base/MixpanelBase.php";
6 /**
7 * Provides some base methods for use by a Consumer implementation
8 */
9 abstract class ConsumerStrategies_AbstractConsumer extends Base_MixpanelBase
10 {
11 /**
12 * Creates a new AbstractConsumer
13 * @param array $options
14 */
15 function __construct($options = array())
16 {
17 parent::__construct($options);
18 if ($this->_debug()) {
19 $this->_log("Instantiated new Consumer");
20 }
21 }
22 /**
23 * Encode an array to be persisted
24 * @param array $params
25 * @return string
26 */
27 protected function _encode($params)
28 {
29 return \base64_encode(\json_encode($params));
30 }
31 /**
32 * Handles errors that occur in a consumer
33 * @param $code
34 * @param $msg
35 */
36 protected function _handleError($code, $msg)
37 {
38 if (isset($this->_options['error_callback'])) {
39 $handler = $this->_options['error_callback'];
40 \call_user_func($handler, $code, $msg);
41 }
42 if ($this->_debug()) {
43 $arr = \debug_backtrace();
44 $class = \get_class($arr[0]['object']);
45 $line = $arr[0]['line'];
46 \error_log("[ {$class} - line {$line} ] : " . \print_r($msg, \true));
47 }
48 }
49 /**
50 * Number of requests/batches that will be processed in parallel.
51 * @return int
52 */
53 public function getNumThreads()
54 {
55 return 1;
56 }
57 /**
58 * Persist a batch of messages in whatever way the implementer sees fit
59 * @param array $batch an array of messages to consume
60 * @return boolean success or fail
61 */
62 abstract function persist($batch);
63 }
64