From 3be8563870963442b0455a353e02c459d51ebd19 Mon Sep 17 00:00:00 2001 From: Pedro Silva
+ * $package = Package::new();
+ *
+ * add_action(
+ * $package->hookName(Package::ACTION_INIT),
+ * $callback
+ * );
+ *
+ */
+ public const ACTION_INIT = 'init';
+
+ /**
+ * Custom action which is triggered after the application
+ * is booted to access container and properties.
+ *
+ * @example
+ *
+ * $package = Package::new();
+ *
+ * add_action(
+ * $package->hookName(Package::ACTION_READY),
+ * $callback
+ * );
+ *
+ */
+ public const ACTION_READY = 'ready';
+
+ /**
+ * Custom action which is triggered when a failure happens during the building stage.
+ *
+ * @example
+ *
+ * $package = Package::new();
+ *
+ * add_action(
+ * $package->hookName(Package::ACTION_FAILED_BUILD),
+ * $callback
+ * );
+ *
+ */
+ public const ACTION_FAILED_BUILD = 'failed-build';
+
+ /**
+ * Custom action which is triggered when a failure happens during the booting stage.
+ *
+ * @example
+ *
+ * $package = Package::new();
+ *
+ * add_action(
+ * $package->hookName(Package::ACTION_FAILED_BOOT),
+ * $callback
+ * );
+ *
+ */
+ public const ACTION_FAILED_BOOT = 'failed-boot';
+
+ /**
+ * Custom action which is triggered when a package is connected.
+ */
+ public const ACTION_PACKAGE_CONNECTED = 'package-connected';
+
+ /**
+ * Custom action which is triggered when a package cannot be connected.
+ */
+ public const ACTION_FAILED_CONNECTION = 'failed-connection';
+
+ /**
+ * Module states can be used to get information about your module.
+ *
+ * @example
+ *
+ * $package = Package::new();
+ * $package->moduleIs(SomeModule::class, Package::MODULE_ADDED); // false
+ * $package->boot(new SomeModule());
+ * $package->moduleIs(SomeModule::class, Package::MODULE_ADDED); // true
+ *
+ */
+ public const MODULE_ADDED = 'added';
+ public const MODULE_NOT_ADDED = 'not-added';
+ public const MODULE_REGISTERED = 'registered';
+ public const MODULE_REGISTERED_FACTORIES = 'registered-factories';
+ public const MODULE_EXTENDED = 'extended';
+ public const MODULE_EXECUTED = 'executed';
+ public const MODULE_EXECUTION_FAILED = 'executed-failed';
+ public const MODULES_ALL = '*';
+
+ /**
+ * Custom states for the class.
+ *
+ * @example
+ *
+ * $package = Package::new();
+ * $package->statusIs(Package::IDLE); // true
+ * $package->boot();
+ * $package->statusIs(Package::BOOTED); // true
+ *
+ */
+ public const STATUS_IDLE = 2;
+ public const STATUS_INITIALIZED = 4;
+ public const STATUS_MODULES_ADDED = 5;
+ public const STATUS_READY = 7;
+ public const STATUS_BOOTED = 8;
+ public const STATUS_FAILED = -8;
+
+ /**
+ * Current state of the application.
+ *
+ * @see Package::STATUS_*
+ *
+ * @var int
+ */
+ private $status = self::STATUS_IDLE;
+
+ /**
+ * Contains the progress of all modules.
+ *
+ * @see Package::moduleProgress()
+ *
+ * @var array' . esc_html__( 'WooCommerce PayPal Payments requires PHP 7.1 or above.', 'woocommerce-paypal-payments' ), '
' . esc_html__( 'WooCommerce PayPal Payments requires PHP 7.4 or above.', 'woocommerce-paypal-payments' ), '