Automattic\WooCommerce\Admin\Composer

Package{}WC 1.0

Main package class.

No Hooks.

Usage

$Package = new Package();
// use class methods

Methods

  1. ERROR: no method name found on line `self::$active_version = WC_ADMIN_VERSION_NUMBER;`
  2. ERROR: no method name found on line `*`
  3. ERROR: no method name found on line ``
  4. ERROR: no method name found on line ``
  5. public static get_active_version()
  6. ERROR: no method name found on line `*/`
  7. public static get_path()
  8. ERROR: no method name found on line `}`
  9. ERROR: no method name found on line `*/`
  10. public instance()
  11. ERROR: no method name found on line `}`
  12. ERROR: no method name found on line `* Init the package.`
  13. ERROR: no method name found on line `self::$package_active = true;`
  14. ERROR: no method name found on line `self::$active_version = WC_ADMIN_VERSION_NUMBER;`
  15. public static get_version()
  16. ERROR: no method name found on line `* Return the version of the package.`
  17. public static init()
  18. ERROR: no method name found on line ``
  19. ERROR: no method name found on line `*/`
  20. ERROR: no method name found on line ``
  21. ERROR: no method name found on line ``
  22. ERROR: no method name found on line ``
  23. ERROR: no method name found on line ``
  24. private static is_notes_initialized()
  25. public static is_package_active()
  26. ERROR: no method name found on line `/**`

Code of Package{} WC 7.1.0

class Package {

	/**
	 * Version.
	 *
	 * @var string
	 */
	const VERSION = '3.3.0';

	/**
	 * Package active.
	 *
	 * @var bool
	 */
	private static $package_active = false;

	/**
	 * Active version
	 *
	 * @var bool
	 */
	private static $active_version = null;

	/**
	 * Init the package.
	 *
	 * Only initialize for WP 5.3 or greater.
	 */
	public static function init() {
		// Avoid double initialization when the feature plugin is in use.
		if ( defined( 'WC_ADMIN_VERSION_NUMBER' ) ) {
			self::$active_version = WC_ADMIN_VERSION_NUMBER;
			return;
		}

		$feature_plugin_instance = FeaturePlugin::instance();

		// Indicate to the feature plugin that the core package exists.
		if ( ! defined( 'WC_ADMIN_PACKAGE_EXISTS' ) ) {
			define( 'WC_ADMIN_PACKAGE_EXISTS', true );
		}

		self::$package_active = true;
		self::$active_version = self::VERSION;
		$feature_plugin_instance->init();

		// Unhook the custom Action Scheduler data store class in active older versions of WC Admin.
		remove_filter( 'action_scheduler_store_class', array( $feature_plugin_instance, 'replace_actionscheduler_store_class' ) );
	}

	/**
	 * Return the version of the package.
	 *
	 * @return string
	 */
	public static function get_version() {
		return self::VERSION;
	}

	/**
	 * Return the active version of WC Admin.
	 *
	 * @return string
	 */
	public static function get_active_version() {
		return self::$active_version;
	}

	/**
	 * Return whether the package is active.
	 *
	 * @return bool
	 */
	public static function is_package_active() {
		return self::$package_active;
	}

	/**
	 * Return the path to the package.
	 *
	 * @return string
	 */
	public static function get_path() {
		return dirname( __DIR__ );
	}

	/**
	 * Checks if notes have been initialized.
	 */
	private static function is_notes_initialized() {
		try {
			Notes::load_data_store();
		} catch ( NotesUnavailableException $e ) {
			return false;
		}
		return true;
	}
}