|
Server : Apache System : Linux s1230 5.15.0-139-generic #149~20.04.1 SMP Tue Jul 14 11:21:49 UTC 2026 x86_64 User : p141464 ( 418825) PHP Version : 7.4.33.12 Disable Function : NONE Directory : /html/KMU-CSR-PLANER/wp-content/plugins/matomo/classes/WpMatomo/Ecommerce/ |
Upload File : |
<?php
namespace WpMatomo\Ecommerce;
/**
* this class is required only for phpunit tests.
* It allow to change the visibility of some methods of the Base class
* and so allow to test them in the unit tests
*
* phpcs:disable Generic.CodeAnalysis.UselessOverridingMethod.Found
*/
class MatomoTestEcommerce extends Base {
public $should_track_background = false;
public $supports_delayed_tracking = false;
public $session_data = [];
public $tracked_orders = [];
/**
* Render public the wrap_script method. Required for the unit tests
*
* @param string $script
*
* @return string
* @see Base::wrap_script()
*/
public function wrap_script( $script ) {
return parent::wrap_script( $script );
}
/**
* Render public the wrap_script method. Required for the unit tests
*
* @param [] $params
*
* @return string
* @see Base::make_matomo_js_tracker_call()
*/
public function make_matomo_js_tracker_call( $params ) {
return parent::make_matomo_js_tracker_call( $params );
}
protected function should_track_background() {
return $this->should_track_background;
}
protected function get_tracking_calls_in_session() {
return $this->session_data['ajax_calls'];
}
protected function add_tracking_calls_to_session( $data ) {
$this->session_data['ajax_calls'][] = $data;
}
protected function remove_tracking_calls_in_session() {
$this->session_data['ajax_calls'] = [];
}
/**
* @return bool
*/
public function supports_delayed_tracking() {
return $this->supports_delayed_tracking;
}
public function set_order_been_tracked( $order_id ) {
$this->tracked_orders[] = $order_id;
}
public function has_order_been_tracked_already( $order_id ) {
return in_array( $order_id, $this->tracked_orders, true );
}
}