83% sagepay-direct-gateway-for-woocommerce

Code Review | SagePay Direct Gateway for WooCommerce

WordPress plugin SagePay Direct Gateway for WooCommerce scored83%from 54 tests.

About plugin

  • Plugin page: sagepay-direct-ga...
  • Plugin version: 1.3.0
  • PHP version: 7.4.16
  • WordPress compatibility: 4.5-5.2.3
  • WordPress version: 6.3.1
  • First release: Sep 22, 2015
  • Latest release: Sep 18, 2019
  • Number of updates: 13
  • Update frequency: every 112.0 days
  • Top authors: patsatech (100%)

Code review

54 tests

User reviews

2 reviews

Install metrics

60+ active /2,711 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | It is important to correctly install your plugin, without throwing errors or notices
This plugin's installer ran successfully

Server metrics [RAM: ▲0.14MB] [CPU: ▼3.58ms] Passed 4 tests

This is a short check of server-side resources used by SagePay Direct Gateway for WooCommerce
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /3.61 ▲0.1442.58 ▲3.67
Dashboard /wp-admin3.45 ▲0.1554.21 ▲2.36
Posts /wp-admin/edit.php3.56 ▲0.2151.65 ▼4.09
Add New Post /wp-admin/post-new.php6.03 ▲0.1489.71 ▼11.90
Media Library /wp-admin/upload.php3.37 ▲0.1437.78 ▼0.69

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

Input-output and database impact of this plugin
No storage issues were detected
Filesystem: 12 new files
Database: no new tables, 6 new options
New WordPress options
db_upgraded
widget_recent-comments
widget_theysaidso_widget
can_compress_scripts
widget_recent-posts
theysaidso_admin_options

Browser metrics Passed 4 tests

An overview of browser requirements for SagePay Direct Gateway for WooCommerce
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,789 ▲2814.61 ▲0.021.66 ▼0.1041.09 ▼1.61
Dashboard /wp-admin2,198 ▲215.60 ▼0.0195.63 ▲2.6440.99 ▼1.20
Posts /wp-admin/edit.php2,100 ▼02.03 ▼0.1040.72 ▼2.8736.61 ▼2.03
Add New Post /wp-admin/post-new.php1,526 ▼023.45 ▲0.26669.92 ▲5.6052.32 ▼0.67
Media Library /wp-admin/upload.php1,400 ▼04.25 ▲0.0398.37 ▼6.8443.55 ▼4.51

Uninstaller [IO: ▲0.00MB] [DB: ▲0.00MB] 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 does not fully uninstall, leaving 6 options in the database
    • can_compress_scripts
    • theysaidso_admin_options
    • widget_recent-comments
    • db_upgraded
    • widget_theysaidso_widget
    • 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
Good news, no errors were detected

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
Almost there! Just fix the following items
  • 1× GET requests to PHP files have triggered server-side errors or warnings:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/sagepay-direct-gateway-for-woocommerce/sagepaydirect.php:22

User-side errors Passed 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the browser (console and network errors and warnings)
No browser issues were found

Optimizations

Plugin configuration 86% from 29 tests

readme.txt Passed 16 tests

The readme.txt file is an important file in your plugin as it is parsed by WordPress.org to prepare the public listing of your plugin
6 plugin tags: payment gateway, wordpress, sagepay go, ecommerce, woocommerce...

sagepay-direct-gateway-for-woocommerce/sagepaydirect.php 69% from 13 tests

The primary PHP file in "SagePay Direct Gateway for WooCommerce" version 1.3.0 is used by WordPress to initiate all plugin functionality
The following require your attention:
  • Requires at least: The required version number did not match the one declared in readme.txt ("4.0" instead of "4.5")
  • Main file name: The principal plugin file should be the same as the plugin slug ("sagepay-direct-gateway-for-woocommerce.php" instead of "sagepaydirect.php")
  • Text Domain: The text domain is optional since WordPress version 4.6; if you do specify it, it must be the same as the plugin slug
  • Domain Path: The domain path folder was not found ("/lang/")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | This is an overview of programming languages used in this plugin; dangerous file extensions are not allowed
No dangerous file extensions were detected730 lines of code in 1 file:
LanguageFilesBlank linesComment linesLines of code
PHP110886730

PHP code Passed 2 tests

Analyzing cyclomatic complexity and code structure
No complexity issues detected
Cyclomatic complexity
Average complexity per logical line of code0.43
Average class complexity123.00
▷ Minimum class complexity123.00
▷ Maximum class complexity123.00
Average method complexity7.42
▷ Minimum method complexity1.00
▷ Maximum method complexity51.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes1
▷ Abstract classes00.00%
▷ Concrete classes1100.00%
▷ Final classes00.00%
Methods19
▷ Static methods00.00%
▷ Public methods1157.89%
▷ Protected methods00.00%
▷ Private methods842.11%
Functions2
▷ Named functions2100.00%
▷ Anonymous functions00.00%
Constants0
▷ Global constants00.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

It is recommended to compress PNG files in your plugin to minimize bandwidth usage
10 PNG files occupy 0.11MB with 0.09MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
images/card-amex.png4.45KB1.65KB▼ 62.79%
images/card-maestro.png16.76KB1.79KB▼ 89.31%
images/card-jcb.png5.54KB1.72KB▼ 69.02%
images/card-delta.png19.25KB2.16KB▼ 88.76%
images/card-mc.png5.42KB1.77KB▼ 67.41%