PluginProbe ʕ •ᴥ•ʔ
Worldline Global Online Pay for WooCommerce / 2.5.22
Worldline Global Online Pay for WooCommerce v2.5.22
2.5.22 2.5.20 2.5.17 trunk 1.0.0 1.0.1 2.0.0 2.1.0 2.2.0 2.3.0 2.4.0 2.4.1 2.4.2 2.4.4 2.4.5 2.4.6 2.5.1 2.5.10 2.5.11 2.5.12 2.5.14 2.5.16 2.5.2 2.5.3 2.5.4 2.5.5 2.5.6 2.5.7 2.5.8 2.5.9
worldline-for-woocommerce / inc / error.php
worldline-for-woocommerce / inc Last commit date
admin-views 1 week ago bootstrap.php 1 week ago error.php 1 week ago extensions.php 1 week ago modules.php 1 week ago services.php 1 week ago
error.php
33 lines
1 <?php
2
3 // phpcs:disable Inpsyde.CodeQuality.ArgumentTypeDeclaration.NoArgumentType
4 declare (strict_types=1);
5 namespace Syde\Vendor\Worldline;
6
7 use Syde\Vendor\Worldline\Dhii\Validation\Exception\ValidationFailedExceptionInterface;
8 return (static function () : callable {
9 /**
10 * @psalm-suppress MissingClosureParamType
11 */
12 $formatValidationError = static function ($error) : string {
13 if ($error instanceof \Throwable) {
14 return $error->getMessage();
15 }
16 return (string) $error;
17 };
18 return static function (\Throwable $exception) use($formatValidationError) : void {
19 $message = $exception->getMessage();
20 if ($exception instanceof ValidationFailedExceptionInterface) {
21 $errors = [];
22 foreach ($exception->getValidationErrors() as $validationError) {
23 $errors[] = $formatValidationError($validationError);
24 }
25 $message .= '</br>' . \implode('</br>', $errors);
26 }
27 \add_action('all_admin_notices', static function () use($message) {
28 $class = 'notice notice-error';
29 \printf('<div class="%1$s"><h4>%2$s</h4><p>%3$s</p></div>', \esc_attr($class), \esc_html__('Worldline payments failed to initialize', 'worldline-for-woocommerce'), \wp_kses_post($message));
30 });
31 };
32 })();
33