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 / FileConsumer.php

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

39 lines 1.0 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__) . "/AbstractConsumer.php";
6 /**
7 * Consumes messages and writes them to a file
8 */
9 class ConsumerStrategies_FileConsumer extends ConsumerStrategies_AbstractConsumer
10 {
11 /**
12 * @var string path to a file that we want to write the messages to
13 */
14 private $_file;
15 /**
16 * Creates a new FileConsumer and assigns properties from the $options array
17 * @param array $options
18 */
19 function __construct($options)
20 {
21 parent::__construct($options);
22 // what file to write to?
23 $this->_file = isset($options['file']) ? $options['file'] : \dirname(__FILE__) . "/../../messages.txt";
24 }
25 /**
26 * Append $batch to a file
27 * @param array $batch
28 * @return bool
29 */
30 public function persist($batch)
31 {
32 if (\count($batch) > 0) {
33 return \file_put_contents($this->_file, \json_encode($batch) . "\n", \FILE_APPEND | \LOCK_EX) !== \false;
34 } else {
35 return \true;
36 }
37 }
38 }
39