PluginProbe
WPVR – 360 Panorama viewer and Virtual Tour Builder for WordPress / 8.5.37
WPVR – 360 Panorama viewer and Virtual Tour Builder for WordPress v8.5.37
9.1.3 9.1.2 9.1.1 9.1.0 9.0.3 9.0.2 9.0.1 9.0.0 8.5.79 8.5.78 8.5.77 8.5.76 8.5.75 8.5.74 8.5.73 8.5.72 8.5.71 8.5.70 8.5.69 8.5.68 8.5.35 8.5.36 8.5.37 8.5.38 8.5.39 All 222 releases
wpvr / vendor / posthog / posthog-php / lib / Consumer.php

Consumer.php in WPVR – 360 Panorama viewer and Virtual Tour Builder for WordPress 8.5.37, at vendor/posthog/posthog-php/lib/Consumer.php

85 lines 2.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace PostHog;
4
5 abstract class Consumer
6 {
7 protected $type = "Consumer";
8
9 protected $options;
10 protected $apiKey;
11
12 /**
13 * Store our apiKey and options as part of this consumer
14 * @param string $apiKey
15 * @param array $options
16 */
17 public function __construct($apiKey, $options = array())
18 {
19 $this->apiKey = $apiKey;
20 $this->options = $options;
21 }
22
23 /**
24 * Captures a user action
25 *
26 * @param array $message
27 * @return boolean whether the capture call succeeded
28 */
29 abstract public function capture(array $message);
30
31 /**
32 * Tags properties about the user.
33 *
34 * @param array $message
35 * @return boolean whether the identify call succeeded
36 */
37 abstract public function identify(array $message);
38
39 /**
40 * Aliases from one user id to another
41 *
42 * @param array $message
43 * @return boolean whether the alias call succeeded
44 */
45 abstract public function alias(array $message);
46
47 /**
48 * Check whether debug mode is enabled
49 * @return boolean
50 */
51 protected function debug()
52 {
53 return isset($this->options["debug"]) ? $this->options["debug"] : false;
54 }
55
56 /**
57 * Check whether we should connect to the API using SSL. This is enabled by
58 * default with connections which make batching requests. For connections
59 * which can save on round-trip times, you may disable it.
60 * @return boolean
61 */
62 protected function ssl()
63 {
64 return isset($this->options["ssl"]) ? $this->options["ssl"] : true;
65 }
66
67 /**
68 * On an error, try and call the error handler, if debugging output to
69 * error_log as well.
70 * @param string $code
71 * @param string $msg
72 */
73 protected function handleError($code, $msg)
74 {
75 if (isset($this->options['error_handler'])) {
76 $handler = $this->options['error_handler'];
77 $handler($code, $msg);
78 }
79
80 if ($this->debug()) {
81 error_log("[PostHog][" . $this->type . "] " . $msg);
82 }
83 }
84 }
85