Skip to content

Commit 24e498c

Browse files
committed
Fix CS
1 parent a9c2588 commit 24e498c

11 files changed

+194
-198
lines changed

src/Core/container-definitions.php

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -16,36 +16,38 @@
1616
$gatewayNamespacePrefix = 'Monei\\Gateways\\PaymentMethods\\';
1717
$blockNamespacePrefix = 'Monei\\Gateways\\Blocks\\';
1818
$definitions = array(
19-
// ========== TEMPLATES ==========
20-
// Register each template as an autowired service
21-
NoticeAdminNewInstall::class => DI\autowire( NoticeAdminNewInstall::class ),
22-
SettingsHeader::class => DI\autowire(SettingsHeader::class),
23-
NoticeAdminDependency::class => DI\autowire(NoticeAdminDependency::class),
24-
NoticeGatewayNotAvailable::class => DI\autowire(NoticeGatewayNotAvailable::class),
25-
NoticeGatewayNotAvailableApi::class => DI\autowire(NoticeGatewayNotAvailableApi::class),
26-
NoticeGatewayNotEnabledMonei::class => DI\autowire(NoticeGatewayNotEnabledMonei::class),
19+
// ========== TEMPLATES ==========
20+
// Register each template as an autowired service
21+
NoticeAdminNewInstall::class => DI\autowire( NoticeAdminNewInstall::class ),
22+
SettingsHeader::class => DI\autowire( SettingsHeader::class ),
23+
NoticeAdminDependency::class => DI\autowire( NoticeAdminDependency::class ),
24+
NoticeGatewayNotAvailable::class => DI\autowire( NoticeGatewayNotAvailable::class ),
25+
NoticeGatewayNotAvailableApi::class => DI\autowire( NoticeGatewayNotAvailableApi::class ),
26+
NoticeGatewayNotEnabledMonei::class => DI\autowire( NoticeGatewayNotEnabledMonei::class ),
2727

2828

29-
// array of [ 'short-template-name' => <template-class-instance> ]
30-
TemplateManager::class => DI\create( TemplateManager::class )
31-
->constructor([
32-
'notice-admin-new-install' => DI\get( NoticeAdminNewInstall::class ),
33-
'monei-settings-header' => DI\get(SettingsHeader::class),
34-
'notice-admin-dependency' => DI\get(NoticeAdminDependency::class),
35-
'notice-admin-gateway-not-available' => DI\get(NoticeGatewayNotAvailable::class),
36-
'notice-admin-gateway-not-available-api' => DI\get(NoticeGatewayNotAvailableApi::class),
37-
'notice-admin-gateway-not-enabled-monei' => DI\get(NoticeGatewayNotEnabledMonei::class),
38-
]),
29+
// array of [ 'short-template-name' => <template-class-instance> ]
30+
TemplateManager::class => DI\create( TemplateManager::class )
31+
->constructor(
32+
array(
33+
'notice-admin-new-install' => DI\get( NoticeAdminNewInstall::class ),
34+
'monei-settings-header' => DI\get( SettingsHeader::class ),
35+
'notice-admin-dependency' => DI\get( NoticeAdminDependency::class ),
36+
'notice-admin-gateway-not-available' => DI\get( NoticeGatewayNotAvailable::class ),
37+
'notice-admin-gateway-not-available-api' => DI\get( NoticeGatewayNotAvailableApi::class ),
38+
'notice-admin-gateway-not-enabled-monei' => DI\get( NoticeGatewayNotEnabledMonei::class ),
39+
)
40+
),
3941
// ========== PAYMENT METHOD SERVICES ==========
40-
PaymentMethodsRepository::class => DI\factory(
42+
PaymentMethodsRepository::class => DI\factory(
4143
function () {
4244
$accountId = get_option( 'monei_accountid' );
4345
return new Monei\Repositories\PaymentMethodsRepository( $accountId );
4446
}
4547
),
46-
PaymentMethodsService::class => DI\create( PaymentMethodsService::class )
48+
PaymentMethodsService::class => DI\create( PaymentMethodsService::class )
4749
->constructor( DI\get( PaymentMethodsRepository::class ) ),
48-
BlockSupportService::class => DI\create( BlockSupportService::class )
50+
BlockSupportService::class => DI\create( BlockSupportService::class )
4951
->constructor( $blocksPath, $blockNamespacePrefix ),
5052
);
5153

@@ -55,7 +57,7 @@ function () {
5557

5658
if ( class_exists( $className ) ) {
5759
$definitions[ $className ] = DI\autowire();
58-
}
60+
}
5961
}
6062

6163
// Dynamically register block support classes

src/Gateways/Abstracts/WCMoneiPaymentGateway.php

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -116,11 +116,11 @@ abstract class WCMoneiPaymentGateway extends WC_Payment_Gateway {
116116
public $form_fields = array();
117117

118118
public PaymentMethodsService $paymentMethodsService;
119-
private TemplateManager $templateManager;
119+
private TemplateManager $templateManager;
120120

121-
public function __construct( PaymentMethodsService $paymentMethodsService, TemplateManager $templateManager) {
121+
public function __construct( PaymentMethodsService $paymentMethodsService, TemplateManager $templateManager ) {
122122
$this->paymentMethodsService = $paymentMethodsService;
123-
$this->templateManager = $templateManager;
123+
$this->templateManager = $templateManager;
124124
}
125125

126126
/**
@@ -182,24 +182,24 @@ public function admin_options() {
182182
parent::admin_options();
183183
} else {
184184
if ( ! $this->getAccountId() || ! $this->getApiKey() ) {
185-
$template = $this->templateManager->getTemplate('notice-admin-gateway-not-available-api');
186-
if ( $template ) {
187-
$template->render([]);
188-
}
185+
$template = $this->templateManager->getTemplate( 'notice-admin-gateway-not-available-api' );
186+
if ( $template ) {
187+
$template->render( array() );
188+
}
189189
return;
190190
}
191191
$methodAvailability = $this->paymentMethodsService->getMethodAvailability( $this->id, $this->getAccountId() );
192192
if ( ! $methodAvailability ) {
193-
$template = $this->templateManager->getTemplate('notice-admin-gateway-not-enabled-monei');
194-
if ( $template ) {
195-
$template->render([]);
196-
}
193+
$template = $this->templateManager->getTemplate( 'notice-admin-gateway-not-enabled-monei' );
194+
if ( $template ) {
195+
$template->render( array() );
196+
}
197197
return;
198198
}
199-
$template = $this->templateManager->getTemplate('notice-admin-gateway-not-available');
200-
if ( $template ) {
201-
$template->render([]);
202-
}
199+
$template = $this->templateManager->getTemplate( 'notice-admin-gateway-not-available' );
200+
if ( $template ) {
201+
$template->render( array() );
202+
}
203203
}
204204
}
205205

src/Settings/MoneiSettings.php

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@
77

88
class MoneiSettings extends \WC_Settings_Page {
99

10-
protected ContainerInterface $container;
10+
protected ContainerInterface $container;
1111

12-
public function __construct(ContainerInterface $container) {
13-
$this->id = 'monei_settings';
14-
$this->label = __( 'MONEI Settings', 'monei' );
15-
$this->container = $container;
12+
public function __construct( ContainerInterface $container ) {
13+
$this->id = 'monei_settings';
14+
$this->label = __( 'MONEI Settings', 'monei' );
15+
$this->container = $container;
1616
parent::__construct();
1717
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_scripts' ) );
1818
}
@@ -72,19 +72,19 @@ public function get_settings() {
7272
}
7373

7474
public function output() {
75-
$data = [
76-
'moneiIconUrl' => WC_Monei()->image_url('monei-logo.svg'),
77-
'welcomeString' => __('Welcome to MONEI! Enhance your payment processing experience with our seamless integration', 'monei'),
78-
'dashboardString' => __('Go to Dashboard', 'monei'),
79-
'supportString' => __('Support', 'monei'),
80-
];
75+
$data = array(
76+
'moneiIconUrl' => WC_Monei()->image_url( 'monei-logo.svg' ),
77+
'welcomeString' => __( 'Welcome to MONEI! Enhance your payment processing experience with our seamless integration', 'monei' ),
78+
'dashboardString' => __( 'Go to Dashboard', 'monei' ),
79+
'supportString' => __( 'Support', 'monei' ),
80+
);
8181

82-
$templateManager = $this->container->get('Monei\Templates\TemplateManager' );
83-
$template = $templateManager->getTemplate('monei-settings-header');
84-
if ( $template ) {
82+
$templateManager = $this->container->get( 'Monei\Templates\TemplateManager' );
83+
$template = $templateManager->getTemplate( 'monei-settings-header' );
84+
if ( $template ) {
8585

86-
$template->render($data);
87-
}
86+
$template->render( $data );
87+
}
8888
$settings = $this->get_settings();
8989
WC_Admin_Settings::output_fields( $settings );
9090
}

src/Templates/NoticeAdminDependency.php

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,17 @@
22

33
namespace Monei\Templates;
44

5-
class NoticeAdminDependency implements TemplateInterface
6-
{
5+
class NoticeAdminDependency implements TemplateInterface {
76

8-
public function render( $data ): void
9-
{
10-
?>
117

12-
<div class="notice notice-error">
13-
<p>
14-
<strong><?php echo esc_html_e( 'MONEI Gateway is inactive because WooCommerce is not installed and active.', 'monei' ); ?></strong>
15-
</p>
16-
</div>
17-
<?php
18-
}
8+
public function render( $data ): void {
9+
?>
10+
11+
<div class="notice notice-error">
12+
<p>
13+
<strong><?php echo esc_html_e( 'MONEI Gateway is inactive because WooCommerce is not installed and active.', 'monei' ); ?></strong>
14+
</p>
15+
</div>
16+
<?php
17+
}
1918
}

src/Templates/NoticeAdminNewInstall.php

Lines changed: 30 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -2,37 +2,36 @@
22

33
namespace Monei\Templates;
44

5-
class NoticeAdminNewInstall implements TemplateInterface
6-
{
5+
class NoticeAdminNewInstall implements TemplateInterface {
76

8-
public function render( $data ): void
9-
{
10-
?>
117

12-
<div id="message" class="updated woocommerce-message woocommerce-monei-messages">
13-
<div class="contenido-monei-notice">
14-
<a class="woocommerce-message-close notice-dismiss" style="top:0;"
15-
href="<?php echo esc_url(wp_nonce_url(add_query_arg('monei-hide-new-version', 'hide-new-version-monei'), 'monei_hide_new_version_nonce', '_monei_hide_new_version_nonce')); ?>"><?php esc_html_e('Dismiss', 'monei'); ?></a>
16-
<p>
17-
<h3>
18-
<?php esc_html_e('Thank you for install MONEI for WooCommerce. Version: ', 'monei') . ' ' . esc_html(MONEI_VERSION); ?>
19-
</h3>
20-
</p>
21-
<p>
22-
<?php esc_html_e('The best payment gateway rates. The perfect solution to manage your digital payments.', 'monei'); ?>
23-
</p>
24-
<p class="submit">
25-
<a href="<?php echo esc_url(MONEI_SIGNUP); ?>" class="button-primary"
26-
target="_blank"><?php esc_html_e('Signup', 'monei'); ?></a>
27-
<a href="<?php echo esc_url(MONEI_WEB); ?>" class="button-primary"
28-
target="_blank"><?php esc_html_e('MONEI website', 'monei'); ?></a>
29-
<a href="<?php echo esc_url(MONEI_REVIEW); ?>" class="button-primary"
30-
target="_blank"><?php esc_html_e('Leave a review', 'monei'); ?></a>
31-
<a href="<?php echo esc_url(MONEI_SUPPORT); ?>" class="button-primary"
32-
target="_blank"><?php esc_html_e('Support', 'monei'); ?></a>
33-
</p>
34-
</div>
35-
</div>
36-
<?php
37-
}
8+
public function render( $data ): void {
9+
?>
10+
11+
<div id="message" class="updated woocommerce-message woocommerce-monei-messages">
12+
<div class="contenido-monei-notice">
13+
<a class="woocommerce-message-close notice-dismiss" style="top:0;"
14+
href="<?php echo esc_url( wp_nonce_url( add_query_arg( 'monei-hide-new-version', 'hide-new-version-monei' ), 'monei_hide_new_version_nonce', '_monei_hide_new_version_nonce' ) ); ?>"><?php esc_html_e( 'Dismiss', 'monei' ); ?></a>
15+
<p>
16+
<h3>
17+
<?php esc_html_e( 'Thank you for install MONEI for WooCommerce. Version: ', 'monei' ) . ' ' . esc_html( MONEI_VERSION ); ?>
18+
</h3>
19+
</p>
20+
<p>
21+
<?php esc_html_e( 'The best payment gateway rates. The perfect solution to manage your digital payments.', 'monei' ); ?>
22+
</p>
23+
<p class="submit">
24+
<a href="<?php echo esc_url( MONEI_SIGNUP ); ?>" class="button-primary"
25+
target="_blank"><?php esc_html_e( 'Signup', 'monei' ); ?></a>
26+
<a href="<?php echo esc_url( MONEI_WEB ); ?>" class="button-primary"
27+
target="_blank"><?php esc_html_e( 'MONEI website', 'monei' ); ?></a>
28+
<a href="<?php echo esc_url( MONEI_REVIEW ); ?>" class="button-primary"
29+
target="_blank"><?php esc_html_e( 'Leave a review', 'monei' ); ?></a>
30+
<a href="<?php echo esc_url( MONEI_SUPPORT ); ?>" class="button-primary"
31+
target="_blank"><?php esc_html_e( 'Support', 'monei' ); ?></a>
32+
</p>
33+
</div>
34+
</div>
35+
<?php
36+
}
3837
}

src/Templates/NoticeGatewayNotAvailable.php

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,16 @@
22

33
namespace Monei\Templates;
44

5-
class NoticeGatewayNotAvailable implements TemplateInterface
6-
{
7-
public function render( $data ): void
8-
{
9-
?>
5+
class NoticeGatewayNotAvailable implements TemplateInterface {
106

11-
<div class="inline error">
12-
<p>
13-
<strong><?php esc_html_e( 'Gateway Disabled', 'monei' ); ?></strong>: <?php esc_html_e( 'MONEI only support EUROS, USD & GBP currencies.', 'monei' ); ?>
14-
</p>
15-
</div>
16-
<?php
17-
}
7+
public function render( $data ): void {
8+
?>
9+
10+
<div class="inline error">
11+
<p>
12+
<strong><?php esc_html_e( 'Gateway Disabled', 'monei' ); ?></strong>: <?php esc_html_e( 'MONEI only support EUROS, USD & GBP currencies.', 'monei' ); ?>
13+
</p>
14+
</div>
15+
<?php
16+
}
1817
}

src/Templates/NoticeGatewayNotAvailableApi.php

Lines changed: 23 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,28 @@
22

33
namespace Monei\Templates;
44

5-
class NoticeGatewayNotAvailableApi implements TemplateInterface
6-
{
7-
public function render( $data ): void
8-
{
9-
$settings_link = esc_url(
10-
admin_url(
11-
add_query_arg(
12-
array(
13-
'page' => 'wc-settings',
14-
'tab' => 'monei_settings',
15-
),
16-
'admin.php'
17-
)
18-
)
19-
);
20-
?>
5+
class NoticeGatewayNotAvailableApi implements TemplateInterface {
216

22-
<div class="inline error">
23-
<p>
24-
<strong><?php esc_html_e( 'Gateway Disabled', 'monei' ); ?></strong>: <?php esc_html_e( 'MONEI API key or Account ID is missing.', 'monei' ); ?>
25-
<a href="<?php echo esc_url( $settings_link ); ?>"><?php esc_html_e( 'Go to MONEI API Key Settings', 'monei' ); ?></a>
26-
</p>
27-
</div>
28-
<?php
29-
}
7+
public function render( $data ): void {
8+
$settings_link = esc_url(
9+
admin_url(
10+
add_query_arg(
11+
array(
12+
'page' => 'wc-settings',
13+
'tab' => 'monei_settings',
14+
),
15+
'admin.php'
16+
)
17+
)
18+
);
19+
?>
20+
21+
<div class="inline error">
22+
<p>
23+
<strong><?php esc_html_e( 'Gateway Disabled', 'monei' ); ?></strong>: <?php esc_html_e( 'MONEI API key or Account ID is missing.', 'monei' ); ?>
24+
<a href="<?php echo esc_url( $settings_link ); ?>"><?php esc_html_e( 'Go to MONEI API Key Settings', 'monei' ); ?></a>
25+
</p>
26+
</div>
27+
<?php
28+
}
3029
}

src/Templates/NoticeGatewayNotEnabledMonei.php

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,17 @@
22

33
namespace Monei\Templates;
44

5-
class NoticeGatewayNotEnabledMonei implements TemplateInterface
6-
{
7-
public function render( $data ): void
8-
{
9-
?>
5+
class NoticeGatewayNotEnabledMonei implements TemplateInterface {
106

11-
<div class="inline error">
12-
<p>
13-
<strong><?php esc_html_e( 'Gateway Disabled', 'monei' ); ?></strong>: <?php esc_html_e( 'The selected payment method is not active in the MONEI dashboard.', 'monei' ); ?>
14-
<a href="https://dashboard.monei.com/?action=signIn"><?php esc_html_e( 'Go to your MONEI Dashboard to activate it', 'monei' ); ?></a>
15-
</p>
16-
</div>
17-
<?php
18-
}
7+
public function render( $data ): void {
8+
?>
9+
10+
<div class="inline error">
11+
<p>
12+
<strong><?php esc_html_e( 'Gateway Disabled', 'monei' ); ?></strong>: <?php esc_html_e( 'The selected payment method is not active in the MONEI dashboard.', 'monei' ); ?>
13+
<a href="https://dashboard.monei.com/?action=signIn"><?php esc_html_e( 'Go to your MONEI Dashboard to activate it', 'monei' ); ?></a>
14+
</p>
15+
</div>
16+
<?php
17+
}
1918
}

0 commit comments

Comments
 (0)