diff --git a/composer.json b/composer.json index 25399e795..9cfb99af8 100644 --- a/composer.json +++ b/composer.json @@ -12,7 +12,7 @@ } ], "require": { - "dhii/module-interface": "0.2.x-dev", + "dhii/module-interface": "0.1", "psr/container": "^1.0", "oomphinc/composer-installers-extender": "^1.1", "container-interop/service-provider": "^0.4.0", diff --git a/modules/ppcp-admin-notices/src/class-adminnotices.php b/modules/ppcp-admin-notices/src/class-adminnotices.php index 1cc89e173..e8ae55b47 100644 --- a/modules/ppcp-admin-notices/src/class-adminnotices.php +++ b/modules/ppcp-admin-notices/src/class-adminnotices.php @@ -36,7 +36,7 @@ class AdminNotices implements ModuleInterface { * * @param ContainerInterface $container The container. */ - public function run( ContainerInterface $container ) { + public function run( ContainerInterface $container = null ) { add_action( 'admin_notices', function() use ( $container ) { @@ -45,4 +45,12 @@ class AdminNotices implements ModuleInterface { } ); } + + /** + * Returns the key for the module. + * + * @return string|void + */ + public function getKey() { + } } diff --git a/modules/ppcp-api-client/src/class-apimodule.php b/modules/ppcp-api-client/src/class-apimodule.php index f944a0245..9b466f87b 100644 --- a/modules/ppcp-api-client/src/class-apimodule.php +++ b/modules/ppcp-api-client/src/class-apimodule.php @@ -37,6 +37,14 @@ class ApiModule implements ModuleInterface { * * @param ContainerInterface $container The container. */ - public function run( ContainerInterface $container ) { + public function run( ContainerInterface $container = null ) { + } + + /** + * Returns the key for the module. + * + * @return string|void + */ + public function getKey() { } } diff --git a/modules/ppcp-button/src/class-buttonmodule.php b/modules/ppcp-button/src/class-buttonmodule.php index 352ec54e2..8d06a91fe 100644 --- a/modules/ppcp-button/src/class-buttonmodule.php +++ b/modules/ppcp-button/src/class-buttonmodule.php @@ -41,9 +41,9 @@ class ButtonModule implements ModuleInterface { /** * Runs the module. * - * @param ContainerInterface $container The Container. + * @param ContainerInterface|null $container The Container. */ - public function run( ContainerInterface $container ) { + public function run( ContainerInterface $container = null ) { add_action( 'wp', @@ -151,4 +151,12 @@ class ButtonModule implements ModuleInterface { } ); } + + /** + * Returns the key for the module. + * + * @return string|void + */ + public function getKey() { + } } diff --git a/modules/ppcp-onboarding/src/class-onboardingmodule.php b/modules/ppcp-onboarding/src/class-onboardingmodule.php index bf757eec6..3613ea1f7 100644 --- a/modules/ppcp-onboarding/src/class-onboardingmodule.php +++ b/modules/ppcp-onboarding/src/class-onboardingmodule.php @@ -38,9 +38,9 @@ class OnboardingModule implements ModuleInterface { /** * Runs the module. * - * @param ContainerInterface $container The container. + * @param ContainerInterface|null $container The container. */ - public function run( ContainerInterface $container ) { + public function run( ContainerInterface $container = null ) { $asset_loader = $container->get( 'onboarding.assets' ); /** @@ -100,4 +100,12 @@ class OnboardingModule implements ModuleInterface { } ); } + + /** + * Returns the key for the module. + * + * @return string|void + */ + public function getKey() { + } } diff --git a/modules/ppcp-session/src/class-sessionmodule.php b/modules/ppcp-session/src/class-sessionmodule.php index ee145e64b..8e1d97055 100644 --- a/modules/ppcp-session/src/class-sessionmodule.php +++ b/modules/ppcp-session/src/class-sessionmodule.php @@ -35,9 +35,9 @@ class SessionModule implements ModuleInterface { /** * Run the module. * - * @param ContainerInterface $container The container. + * @param ContainerInterface|null $container The container. */ - public function run( ContainerInterface $container ) { + public function run( ContainerInterface $container = null ) { add_action( 'woocommerce_init', function () use ( $container ) { @@ -51,4 +51,12 @@ class SessionModule implements ModuleInterface { } ); } + + /** + * Returns the key for the module. + * + * @return string|void + */ + public function getKey() { + } } diff --git a/modules/ppcp-subscription/src/class-subscriptionmodule.php b/modules/ppcp-subscription/src/class-subscriptionmodule.php index abc4ea881..a87c93213 100644 --- a/modules/ppcp-subscription/src/class-subscriptionmodule.php +++ b/modules/ppcp-subscription/src/class-subscriptionmodule.php @@ -35,9 +35,9 @@ class SubscriptionModule implements ModuleInterface { /** * Runs the module. * - * @param ContainerInterface $container The container. + * @param ContainerInterface|null $container The container. */ - public function run( ContainerInterface $container ) { + public function run( ContainerInterface $container = null ) { add_action( 'woocommerce_scheduled_subscription_payment_' . PayPalGateway::ID, static function ( $amount, $order ) use ( $container ) { @@ -51,4 +51,12 @@ class SubscriptionModule implements ModuleInterface { 2 ); } + + /** + * Returns the key for the module. + * + * @return string|void + */ + public function getKey() { + } } diff --git a/modules/ppcp-wc-gateway/src/class-wcgatewaymodule.php b/modules/ppcp-wc-gateway/src/class-wcgatewaymodule.php index adb736a5a..577fb1512 100644 --- a/modules/ppcp-wc-gateway/src/class-wcgatewaymodule.php +++ b/modules/ppcp-wc-gateway/src/class-wcgatewaymodule.php @@ -49,9 +49,9 @@ class WcGatewayModule implements ModuleInterface { /** * Runs the module. * - * @param ContainerInterface $container The container. + * @param ContainerInterface|null $container The container. */ - public function run( ContainerInterface $container ) { + public function run( ContainerInterface $container = null ) { $this->register_payment_gateways( $container ); $this->register_order_functionality( $container ); $this->register_columns( $container ); @@ -164,9 +164,9 @@ class WcGatewayModule implements ModuleInterface { /** * Registers the payment gateways. * - * @param ContainerInterface $container The container. + * @param ContainerInterface|null $container The container. */ - private function register_payment_gateways( ContainerInterface $container ) { + private function register_payment_gateways( ContainerInterface $container = null ) { add_filter( 'woocommerce_payment_gateways', @@ -356,4 +356,13 @@ class WcGatewayModule implements ModuleInterface { 2 ); } + + + /** + * Returns the key for the module. + * + * @return string|void + */ + public function getKey() { + } } diff --git a/modules/ppcp-webhooks/src/class-webhookmodule.php b/modules/ppcp-webhooks/src/class-webhookmodule.php index 6f43adadd..4156f816c 100644 --- a/modules/ppcp-webhooks/src/class-webhookmodule.php +++ b/modules/ppcp-webhooks/src/class-webhookmodule.php @@ -34,9 +34,9 @@ class WebhookModule implements ModuleInterface { /** * Run the Webhook module. * - * @param ContainerInterface $container The Container. + * @param ContainerInterface|null $container The Container. */ - public function run( ContainerInterface $container ) { + public function run( ContainerInterface $container = null ) { add_action( 'rest_api_init', static function () use ( $container ) { @@ -76,4 +76,12 @@ class WebhookModule implements ModuleInterface { } ); } + + /** + * Returns the key for the module. + * + * @return string|void + */ + public function getKey() { + } } diff --git a/modules/woocommerce-logging/src/class-woocommerceloggingmodule.php b/modules/woocommerce-logging/src/class-woocommerceloggingmodule.php index ce135da89..aa629b5c8 100644 --- a/modules/woocommerce-logging/src/class-woocommerceloggingmodule.php +++ b/modules/woocommerce-logging/src/class-woocommerceloggingmodule.php @@ -36,6 +36,15 @@ class WooCommerceLoggingModule implements ModuleInterface { * * @param ContainerInterface $container The container. */ - public function run( ContainerInterface $container ) { + public function run( ContainerInterface $container = null ) { + } + + + /** + * Returns the key for the module. + * + * @return string|void + */ + public function getKey() { } } diff --git a/src/class-pluginmodule.php b/src/class-pluginmodule.php index df74ca27a..b961c4878 100644 --- a/src/class-pluginmodule.php +++ b/src/class-pluginmodule.php @@ -29,9 +29,16 @@ class PluginModule implements ModuleInterface { /** * Runs the module. * - * @param ContainerInterface $container The Container. + * @param ContainerInterface|null $container The Container. */ - public function run( ContainerInterface $container ) { - // TODO: Implement run() method. + public function run( ContainerInterface $container = null ) { + } + + /** + * Returns the key for the module. + * + * @return string|void + */ + public function getKey() { } }