84% afterpay-gateway-for-woocommerce

Code Review | Afterpay Gateway for WooCommerce

WordPress plugin Afterpay Gateway for WooCommerce scored84%from 54 tests.

About plugin

  • Plugin page: afterpay-gateway-...
  • Plugin version: 3.6.1
  • PHP version: 7.4.16
  • WordPress compatibility: 3.2.6-6.3.1
  • WordPress version: 6.3.1
  • First release: Aug 29, 2018
  • Latest release: Sep 28, 2023
  • Number of updates: 48
  • Update frequency: every 39.7 days
  • Top authors: afterpayit (100%)

Code review

54 tests

User reviews

43 reviews

Install metrics

20,000+ active /322,033 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | The install procedure must perform silently
Installer ran successfully

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

An overview of server-side resources used by Afterpay Gateway for WooCommerce
This plugin does not affect your website's performance
PageMemory (MB)CPU Time (ms)
Home /3.48 ▲0.0236.19 ▼6.23
Dashboard /wp-admin3.32 ▲0.0150.94 ▲0.55
Posts /wp-admin/edit.php3.37 ▲0.0145.52 ▲0.63
Add New Post /wp-admin/post-new.php5.90 ▲0.0192.94 ▲2.65
Media Library /wp-admin/upload.php3.24 ▲0.0135.28 ▼1.37

Server storage [IO: ▲0.37MB] [DB: ▲0.07MB] Passed 3 tests

How much does this plugin use your filesystem and database?
There were no storage issued detected upon installing this plugin
Filesystem: 81 new files
Database: no new tables, 6 new options
New WordPress options
widget_recent-posts
db_upgraded
theysaidso_admin_options
widget_recent-comments
can_compress_scripts
widget_theysaidso_widget

Browser metrics Passed 4 tests

This is an overview of browser requirements for Afterpay Gateway for WooCommerce
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,825 ▲9013.33 ▼1.351.85 ▼0.1837.12 ▼11.83
Dashboard /wp-admin2,203 ▲155.89 ▲0.01118.93 ▲4.0843.47 ▼1.39
Posts /wp-admin/edit.php2,089 ▼01.99 ▼0.0236.47 ▼0.4232.95 ▲0.38
Add New Post /wp-admin/post-new.php1,545 ▲1018.17 ▼4.90600.03 ▼48.2251.18 ▼13.63
Media Library /wp-admin/upload.php1,391 ▲34.24 ▲0.0496.72 ▼9.8741.16 ▼2.77

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
You still need to fix the following
  • This plugin did not uninstall successfully, leaving 6 options in the database
    • can_compress_scripts
    • db_upgraded
    • widget_theysaidso_widget
    • widget_recent-comments
    • theysaidso_admin_options
    • widget_recent-posts

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for server-side errors
The smoke test was a success, however most plugin functionality was not tested

SRP 50% from 2 tests

🔹 Tests weight: 20 | The single-responsibility principle: PHP files have to remain inert when accessed directly, throwing no errors and performing no actions
Please fix the following
  • 46× PHP files trigger server errors when accessed directly (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'Afterpay\\SDK\\HTTP\\Response' not found in wp-content/plugins/afterpay-gateway-for-woocommerce/vendor/afterpay-global/afterpay-sdk-php/src/HTTP/Response/DeferredPaymentCapture.php:25
    • > PHP Fatal error
      Uncaught Error: Class 'Afterpay\\SDK\\Model' not found in wp-content/plugins/afterpay-gateway-for-woocommerce/vendor/afterpay-global/afterpay-sdk-php/src/Model/ShippingCourier.php:23
    • > PHP Fatal error
      Uncaught Error: Class 'Afterpay\\SDK\\HTTP\\Response' not found in wp-content/plugins/afterpay-gateway-for-woocommerce/vendor/afterpay-global/afterpay-sdk-php/src/HTTP/Response/DeferredPaymentVoid.php:26
    • > PHP Fatal error
      Uncaught Error: Class 'Afterpay\\SDK\\HTTP\\Request' not found in wp-content/plugins/afterpay-gateway-for-woocommerce/vendor/afterpay-global/afterpay-sdk-php/src/HTTP/Request/GetConfiguration.php:23
    • > PHP Fatal error
      Uncaught Error: Class 'Afterpay\\SDK\\HTTP' not found in wp-content/plugins/afterpay-gateway-for-woocommerce/vendor/afterpay-global/afterpay-sdk-php/src/HTTP/Response.php:25
    • > PHP Fatal error
      Uncaught Error: Class 'Afterpay\\SDK\\HTTP\\Request' not found in wp-content/plugins/afterpay-gateway-for-woocommerce/vendor/afterpay-global/afterpay-sdk-php/src/HTTP/Request/UpdatePaymentByOrderId.php:25
    • > PHP Fatal error
      Uncaught Error: Class 'Afterpay\\SDK\\HTTP\\Request' not found in wp-content/plugins/afterpay-gateway-for-woocommerce/vendor/afterpay-global/afterpay-sdk-php/src/HTTP/Request/CreateCheckout.php:33
    • > PHP Fatal error
      Uncaught Error: Class 'Afterpay\\SDK\\HTTP' not found in wp-content/plugins/afterpay-gateway-for-woocommerce/vendor/afterpay-global/afterpay-sdk-php/src/HTTP/Request.php:29
    • > PHP Fatal error
      Trait 'Afterpay\\SDK\\Shared\\ModelMethods' not found in wp-content/plugins/afterpay-gateway-for-woocommerce/vendor/afterpay-global/afterpay-sdk-php/src/Model.php on line 21
    • > PHP Fatal error
      Uncaught Error: Class 'Afterpay\\SDK\\HTTP\\Request' not found in wp-content/plugins/afterpay-gateway-for-woocommerce/vendor/afterpay-global/afterpay-sdk-php/src/HTTP/Request/Ping.php:23

User-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no browser errors were triggered
No browser issues were found

Optimizations

Plugin configuration 96% from 29 tests

readme.txt Passed 16 tests

You should put a lot of thought into formatting readme.txt as it is used by WordPress.org to prepare the public listing of your plugin
2 plugin tags: woocommerce, afterpay

afterpay-gateway-for-woocommerce/afterpay-gateway-for-woocommerce.php 92% from 13 tests

"Afterpay Gateway for WooCommerce" version 3.6.1's main PHP file describes plugin functionality and also serves as the entry point to any WordPress functionality
You should first fix the following items:
  • Requires at least: The required version number must match the one declared in readme.txt ("4.8.3" instead of "3.2.6")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short glimpse at programming languages used with this plugin and a check that no dangerous files are present
There were no executable files found in this plugin6,381 lines of code in 78 files:
LanguageFilesBlank linesComment linesLines of code
PHP711,1973,0636,261
JSON20088
CSS16628
JavaScript4004

PHP code Passed 2 tests

Analyzing cyclomatic complexity and code structure
There are no cyclomatic complexity problems detected for this plugin
Cyclomatic complexity
Average complexity per logical line of code0.48
Average class complexity16.91
▷ Minimum class complexity1.00
▷ Maximum class complexity323.00
Average method complexity3.85
▷ Minimum method complexity1.00
▷ Maximum method complexity61.00
Code structure
Namespaces10
Interfaces0
Traits1
Classes57
▷ Abstract classes00.00%
▷ Concrete classes57100.00%
▷ Final classes1831.58%
Methods323
▷ Static methods6921.36%
▷ Public methods26682.35%
▷ Protected methods185.57%
▷ Private methods3912.07%
Functions11
▷ Named functions00.00%
▷ Anonymous functions11100.00%
Constants4
▷ Global constants250.00%
▷ Class constants250.00%
▷ Public constants2100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
There were not PNG files found in your plugin