<?php if (!defined('ABSPATH')) { exit; } class WC_Queue { protected static $instance = null; protected static $default_cass = 'WC_Action_Queue'; public static final function instance() { if (is_null(self::$instance)) { $class = self::get_class(); self::$instance = new $class(); self::$instance = self::validate_instance(self::$instance); } return self::$instance; } protected static function get_class() { if (!did_action('plugins_loaded')) { wc_doing_it_wrong(__FUNCTION__, __('This function should not be called before plugins_loaded.', 'woocommerce'), '3.5.0'); } return apply_filters('woocommerce_queue_class', self::$default_cass); } protected static function validate_instance($instance) { if (false === $instance instanceof WC_Queue_Interface) { $default_class = self::$default_cass; wc_doing_it_wrong(__FUNCTION__, sprintf(__('The class attached to the "woocommerce_queue_class" does not implement the WC_Queue_Interface interface. The default %s class will be used instead.', 'woocommerce'), $default_class), '3.5.0'); $instance = new $default_class(); } return $instance; } }