Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix remaining coding standards issues #6

Merged
merged 2 commits into from
Sep 17, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ script: |

if [ "$CHANGED_FILES" != "" ]; then
composer global require woocommerce/woocommerce-sniffs --update-with-all-dependencies
.config/composer/vendor/bin/phpcs -p $CHANGED_FILES
$HOME/.config/composer/vendor/bin/phpcs -p $CHANGED_FILES
fi
2 changes: 1 addition & 1 deletion modules/ppcp-wc-gateway/src/class-wcgatewaymodule.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ static function ( $notices ) use ( $container ): array {
}
);
add_action(
'woocommerce-paypal-commerce-gateway.deactivate',
'woocommerce_paypal_commerce_gateway_deactivate',
static function () use ( $container ) {
delete_option( Settings::KEY );
delete_option( PayPalRequestIdRepository::KEY );
Expand Down
2 changes: 1 addition & 1 deletion modules/ppcp-webhooks/src/class-webhookmodule.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ static function () use ( $container ) {
);

add_action(
'woocommerce-paypal-commerce-gateway.deactivate',
'woocommerce_paypal_commerce_gateway_deactivate',
static function () use ( $container ) {
$registrar = $container->get( 'webhook.registrar' );
/**
Expand Down
103 changes: 53 additions & 50 deletions woocommerce-paypal-commerce-gateway.php
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
<?php # -*- coding: utf-8 -*-
declare( strict_types = 1 );

<?php
/**
* Plugin Name: PayPal Payments for WooCommerce
* Plugin URI: TODO
* Description: PayPal's latest complete payments processing solution. Accept PayPal. PayPal Credit, credit/debit cards, alternative digital wallets local payment types and bank accounts. Turn on only PayPal options or process a full suite of payment methods. Enable global transaction with extensive currency and country coverage.
* Description: PayPal's latest complete payments processing solution. Accept PayPal, PayPal Credit, credit/debit cards, alternative digital wallets local payment types and bank accounts. Turn on only PayPal options or process a full suite of payment methods. Enable global transaction with extensive currency and country coverage.
* Version: dev-master
* Author: WooCommerce
* Author URI: https://inpsyde.com/
* License: GPL-2.0
* Text Domain: paypal-payments-for-woocommerce
*
* @package WooCommerce\PayPalCommerce
*/

declare( strict_types = 1 );

namespace WooCommerce\PayPalCommerce;

Expand All @@ -21,54 +22,56 @@
use Dhii\Container\ProxyContainer;
use Dhii\Modular\Module\ModuleInterface;

(function () {
( function () {
include __DIR__ . '/vendor/autoload.php';

function init()
{
static $initialized;
if (!$initialized) {
$modules = [new PluginModule()];
foreach (glob(plugin_dir_path(__FILE__).'modules/*/module.php') as $moduleFile) {
$modules[] = (@require $moduleFile)();
}
$providers = [];
foreach ($modules as $module) {
/* @var $module ModuleInterface */
$providers[] = $module->setup();
}
$proxy = new ProxyContainer();
$provider = new CompositeCachingServiceProvider($providers);
$container = new CachingContainer(new DelegatingContainer($provider));
$proxy->setInnerContainer($container);
foreach ($modules as $module) {
/* @var $module ModuleInterface */
$module->run($container);
}
$initialized = true;
/**
* Initialize the plugin and its modules.
*/
function init() {
static $initialized;
if ( ! $initialized ) {
$modules = array( new PluginModule() );
foreach ( glob( plugin_dir_path( __FILE__ ) . 'modules/*/module.php' ) as $module_file ) {
$modules[] = ( require $module_file )();
}
$providers = array();
foreach ( $modules as $module ) {
/* @var $module ModuleInterface module */
$providers[] = $module->setup();
}
$proxy = new ProxyContainer();
$provider = new CompositeCachingServiceProvider( $providers );
$container = new CachingContainer( new DelegatingContainer( $provider ) );
$proxy->setInnerContainer( $container );
foreach ( $modules as $module ) {
/* @var $module ModuleInterface module */
$module->run( $container );
}
$initialized = true;

}
}
}
}

add_action(
'plugins_loaded',
function () {
init();
}
);
register_activation_hook(
__FILE__,
function () {
init();
do_action('woocommerce-paypal-commerce-gateway.activate');
}
);
register_deactivation_hook(
__FILE__,
function () {
init();
do_action('woocommerce-paypal-commerce-gateway.deactivate');
}
);
add_action(
'plugins_loaded',
function () {
init();
}
);
register_activation_hook(
__FILE__,
function () {
init();
do_action( 'woocommerce_paypal_commerce_gateway_activate' );
}
);
register_deactivation_hook(
__FILE__,
function () {
init();
do_action( 'woocommerce_paypal_commerce_gateway_deactivate' );
}
);

})();
} )();