67% swedbank-pay-payments

Code Review | Swedbank Pay WooCommerce Payments

WordPress plugin Swedbank Pay WooCommerce Payments scored67%from 54 tests.

About plugin

  • Plugin page: swedbank-pay-paym...
  • Plugin version: 6.4.1
  • PHP version: 7.4.16
  • WordPress compatibility: 5.5.1-6.3.1
  • WordPress version: 6.3.1
  • First release: Feb 2, 2020
  • Latest release: Sep 25, 2023
  • Number of updates: 61
  • Update frequency: every 21.8 days
  • Top authors: swedbankpay (100%)

Code review

54 tests

User reviews

1 review

Install metrics

100+ active /5,640 total downloads

Benchmarks

Plugin footprint 65% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Verifying that this plugin installs correctly without errors
The plugin installed successfully, without throwing any errors or notices

Server metrics [RAM: ▼0.01MB] [CPU: ▼8.12ms] Passed 4 tests

This is a short check of server-side resources used by Swedbank Pay WooCommerce Payments
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /3.47 ▲0.0037.20 ▼5.45
Dashboard /wp-admin3.31 ▼0.0444.89 ▼15.68
Posts /wp-admin/edit.php3.36 ▲0.0045.21 ▼3.73
Add New Post /wp-admin/post-new.php5.89 ▲0.0093.83 ▼7.63
Media Library /wp-admin/upload.php3.23 ▲0.0034.18 ▼1.91

Server storage [IO: ▲4.83MB] [DB: ▲0.00MB] Passed 3 tests

Analyzing filesystem and database footprints of this plugin
This plugin was installed successfully
Filesystem: 1,041 new files
Database: 1 new table, 7 new options
New tables
wp_payex_transactions
New WordPress options
widget_recent-posts
db_upgraded
theysaidso_admin_options
widget_theysaidso_widget
widget_recent-comments
woocommerce_payex_psp_version
can_compress_scripts

Browser metrics Passed 4 tests

Checking browser requirements for Swedbank Pay WooCommerce Payments
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,828 ▲7113.34 ▼1.044.33 ▲2.1944.35 ▼0.95
Dashboard /wp-admin2,206 ▲184.88 ▲0.0097.62 ▼19.0943.21 ▼0.69
Posts /wp-admin/edit.php2,086 ▼32.02 ▼0.0436.24 ▼3.0729.56 ▼3.39
Add New Post /wp-admin/post-new.php1,542 ▲2823.56 ▲6.04624.72 ▼57.7448.80 ▼10.63
Media Library /wp-admin/upload.php1,382 ▼34.19 ▼0.0698.70 ▼3.4944.35 ▲2.85

Uninstaller [IO: ▲0.00MB] [DB: ▲0.00MB] 50% from 4 tests

🔸 Tests weight: 35 | It is important to correctly uninstall your plugin, without leaving any traces
You still need to fix the following
  • This plugin does not fully uninstall, leaving 1 table in the database
    • wp_payex_transactions
  • This plugin does not fully uninstall, leaving 7 options in the database
    • db_upgraded
    • widget_recent-comments
    • can_compress_scripts
    • theysaidso_admin_options
    • widget_theysaidso_widget
    • woocommerce_payex_psp_version
    • widget_recent-posts

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the server (in the Apache logs)
Everything seems fine, however this is by no means an exhaustive test

SRP 0% from 2 tests

🔹 Tests weight: 20 | It is important to ensure that your PHP files perform no action when accessed directly, respecting the single-responsibility principle
Please take a closer look at the following
  • 1× PHP files output non-empty strings when accessed directly via GET requests:
    • > /wp-content/plugins/swedbank-pay-payments/vendor/adci/full-name-parser/tests/bootstrap.php
  • 792× GET requests to PHP files have triggered server-side errors or warnings (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'SwedbankPay\\Core\\Data' not found in wp-content/plugins/swedbank-pay-payments/vendor/swedbank-pay/swedbank-pay-woocommerce-core/src/SwedbankPay/Core/Order.php:103
    • > PHP Fatal error
      Uncaught Error: Interface 'SwedbankPay\\Framework\\Data\\DataObjectCollectionInterface' not found in wp-content/plugins/swedbank-pay-payments/vendor/swedbank-pay/swedbank-pay-sdk-php/src/SwedbankPay/Framework/DataObjectCollection.php:11
    • > PHP Fatal error
      Uncaught Error: Class 'TestCase' not found in wp-content/plugins/swedbank-pay-payments/vendor/swedbank-pay/swedbank-pay-sdk-php/tests/Unit/SwedbankPayTest/Api/Service/Swish/Resource/Request/PaymentTest.php:15
    • > PHP Fatal error
      Uncaught Error: Class 'SwedbankPay\\Framework\\DataObjectCollection' not found in wp-content/plugins/swedbank-pay-payments/vendor/swedbank-pay/swedbank-pay-sdk-php/src/SwedbankPay/Api/Service/Invoice/Transaction/Resource/Collection/CaptureListCollection.php:8
    • > PHP Fatal error
      Uncaught Error: Class 'AcceptanceTester' not found in wp-content/plugins/swedbank-pay-payments/vendor/swedbank-pay/swedbank-pay-sdk-php/tests/acceptance/CreditcardCept.php:5
    • > PHP Fatal error
      Uncaught Error: Class 'SwedbankPay\\Api\\Service\\Request' not found in wp-content/plugins/swedbank-pay-payments/vendor/swedbank-pay/swedbank-pay-sdk-php/src/SwedbankPay/Api/Service/MobilePay/Transaction/Request/GetTransaction.php:8
    • > PHP Fatal error
      Uncaught Error: Interface 'SwedbankPay\\Api\\Service\\Payment\\Transaction\\Resource\\Response\\Data\\TransactionResourceInterface' not found in wp-content/plugins/swedbank-pay-payments/vendor/swedbank-pay/swedbank-pay-sdk-php/src/SwedbankPay/Api/Service/Invoice/Transaction/Resource/Response/Data/CancellationInterface.php:7
    • > PHP Fatal error
      Uncaught Error: Class 'SwedbankPay\\Api\\Service\\Request' not found in wp-content/plugins/swedbank-pay-payments/vendor/swedbank-pay/swedbank-pay-sdk-php/src/SwedbankPay/Api/Service/Vipps/Transaction/Request/GetReversal.php:8
    • > PHP Fatal error
      Uncaught Error: Class 'TestCase' not found in wp-content/plugins/swedbank-pay-payments/vendor/swedbank-pay/swedbank-pay-sdk-php/tests/Unit/SwedbankPayTest/Api/Service/Payment/Transaction/Resource/Response/ProblemTest.php:9
    • > PHP Fatal error
      Uncaught Error: Interface 'SwedbankPay\\Api\\Service\\Payment\\Transaction\\Resource\\Request\\Data\\CancellationInterface' not found in wp-content/plugins/swedbank-pay-payments/vendor/swedbank-pay/swedbank-pay-sdk-php/src/SwedbankPay/Api/Service/Vipps/Transaction/Resource/Request/Data/TransactionCancellationInterface.php:12

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for browser errors
There were no browser issues found

Optimizations

Plugin configuration 86% from 29 tests

readme.txt 94% from 16 tests

Perhaps the most important file in your plugin readme.txt gets parsed in order to generate the public listing of your plugin
Please fix the following attributes: The official readme.txt might help

swedbank-pay-payments/swedbank-pay-woocommerce-payments.php 77% from 13 tests

Analyzing the main PHP file in "Swedbank Pay WooCommerce Payments" version 6.4.1
Please take the time to fix the following:
  • Main file name: It is recommended to name the main PHP file as the plugin slug ("swedbank-pay-payments.php" instead of "swedbank-pay-woocommerce-payments.php")
  • Text Domain: If you choose to specify the text domain, it must be the same as the plugin slug; optional since WordPress version 4.6
  • Requires at least: Required version must match the one declared in readme.txt ("5.3" instead of "5.5.1")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | This is a short overview of programming languages used in this plugin, detecting executable files
No dangerous file extensions were detected46,829 lines of code in 988 files:
LanguageFilesBlank linesComment linesLines of code
PHP9139,28618,15036,513
JavaScript331678433,621
SVG1003,602
CSS635421,029
JSON12001,014
PO File2222486464
Markdown91570420
XML40274
YAML391163
Sass11011
INI2029
Dockerfile1326
Bourne Shell1203

PHP code Passed 2 tests

An overview of cyclomatic complexity and code structure
Everything seems fine, there were no complexity issues found
Cyclomatic complexity
Average complexity per logical line of code0.15
Average class complexity2.84
▷ Minimum class complexity1.00
▷ Maximum class complexity138.00
Average method complexity1.71
▷ Minimum method complexity1.00
▷ Maximum method complexity47.00
Code structure
Namespaces196
Interfaces220
Traits17
Classes648
▷ Abstract classes50.77%
▷ Concrete classes64399.23%
▷ Final classes10.16%
Methods3,275
▷ Static methods802.44%
▷ Public methods3,15696.37%
▷ Protected methods511.56%
▷ Private methods682.08%
Functions64
▷ Named functions2945.31%
▷ Anonymous functions3554.69%
Constants772
▷ Global constants253.24%
▷ Class constants74796.76%
▷ Public constants747100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
13 PNG files occupy 0.43MB with 0.19MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
docs/image2.png9.24KB4.35KB▼ 52.89%
assets/img/flags@2x.png170.28KB68.04KB▼ 60.04%
assets/images/mobilepay.png11.91KB5.18KB▼ 56.52%
assets/images/trustly.png1.17KB1.58KB0.00%
docs/image3.png10.81KB5.04KB▼ 53.42%