78% bluesnap-payment-gateway-for-woocommerce

Code Review | BlueSnap Payment Gateway for WooCommerce

WordPress plugin BlueSnap Payment Gateway for WooCommerce scored78%from 54 tests.

About plugin

  • Plugin page: bluesnap-payment-...
  • Plugin version: 3.0.1
  • PHP compatiblity: 7.4+
  • PHP version: 7.4.16
  • WordPress compatibility: 3.7.0-6.3
  • WordPress version: 6.3.1
  • First release: Sep 19, 2019
  • Latest release: Aug 23, 2023
  • Number of updates: 27
  • Update frequency: every 53.1 days
  • Top authors: harmz (100%)

Code review

54 tests

User reviews

2 reviews

Install metrics

300+ active /6,707 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.09MB] [CPU: ▼2.46ms] Passed 4 tests

An overview of server-side resources used by BlueSnap Payment Gateway for WooCommerce
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /3.55 ▲0.0941.82 ▲2.18
Dashboard /wp-admin3.39 ▲0.0948.96 ▲1.84
Posts /wp-admin/edit.php3.50 ▲0.1546.63 ▲0.87
Add New Post /wp-admin/post-new.php5.97 ▲0.0882.71 ▼11.76
Media Library /wp-admin/upload.php3.31 ▲0.0835.85 ▼0.78

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

Input-output and database impact of this plugin
There were no storage issued detected upon installing this plugin
Filesystem: 95 new files
Database: no new tables, 6 new options
New WordPress options
db_upgraded
widget_recent-posts
widget_theysaidso_widget
can_compress_scripts
theysaidso_admin_options
widget_recent-comments

Browser metrics Passed 4 tests

Checking browser requirements for BlueSnap Payment Gateway for WooCommerce
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,796 ▲3514.35 ▼0.021.77 ▲0.1743.57 ▲2.68
Dashboard /wp-admin2,202 ▲255.65 ▼0.0194.02 ▲2.6743.19 ▲2.68
Posts /wp-admin/edit.php2,108 ▲82.02 ▲0.0534.91 ▼1.3333.55 ▼2.20
Add New Post /wp-admin/post-new.php1,533 ▲223.06 ▼0.28662.75 ▼23.5257.13 ▲5.30
Media Library /wp-admin/upload.php1,401 ▼24.18 ▼0.0495.14 ▼8.2842.01 ▼4.01

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

🔸 Tests weight: 35 | It is important to correctly uninstall your plugin, without leaving any traces
Please fix the following items
  • The uninstall procedure has failed, leaving 6 options in the database
    • theysaidso_admin_options
    • widget_recent-posts
    • db_upgraded
    • widget_theysaidso_widget
    • widget_recent-comments
    • can_compress_scripts

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for server-side errors
Even though everything seems fine, this is not an exhaustive test

SRP 0% from 2 tests

🔹 Tests weight: 20 | The single-responsibility principle applies for WordPress plugins as well - please make sure your PHP files perform no actions when accessed directly
The following issues need your attention
  • 2× PHP files output non-empty strings when accessed directly via GET requests:
    • > /wp-content/plugins/bluesnap-payment-gateway-for-woocommerce/includes/admin/views/admin-display.php
    • > /wp-content/plugins/bluesnap-payment-gateway-for-woocommerce/templates/public-display.php
  • 6× GET requests to PHP files have triggered server-side errors or warnings:
    • > PHP Notice
      Undefined variable: hide in wp-content/plugins/bluesnap-payment-gateway-for-woocommerce/templates/multicurrency-wrapper.php on line 16
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_attr() in wp-content/plugins/bluesnap-payment-gateway-for-woocommerce/templates/multicurrency-wrapper.php:16
    • > PHP Fatal error
      Uncaught Error: Call to undefined function wp_json_encode() in wp-content/plugins/bluesnap-payment-gateway-for-woocommerce/templates/payment-fields-bluesnap.php:21
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_attr() in wp-content/plugins/bluesnap-payment-gateway-for-woocommerce/templates/payment-fields-bluesnap-ach.php:14
    • > PHP Fatal error
      Uncaught Error: Class 'WC_Bluesnap_Multicurrency' not found in wp-content/plugins/bluesnap-payment-gateway-for-woocommerce/templates/multicurrency-selector.php:17
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_attr() in wp-content/plugins/bluesnap-payment-gateway-for-woocommerce/templates/fraud-kount-iframe.php:16

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)
There were no browser issues found

Optimizations

Plugin configuration 90% from 29 tests

readme.txt Passed 16 tests

Perhaps the most important file in your plugin readme.txt gets parsed in order to generate the public listing of your plugin
7 plugin tags: woocommerce, apple pay, bluesnap, ach, payment...

bluesnap-payment-gateway-for-woocommerce/bluesnap-for-woocommerce.php 77% from 13 tests

The main PHP file in "BlueSnap Payment Gateway for WooCommerce" ver. 3.0.1 adds more information about the plugin and also serves as the entry point for this plugin
It is important to fix the following:
  • Main file name: Please rename the main PHP file in this plugin to the plugin slug ("bluesnap-payment-gateway-for-woocommerce.php" instead of "bluesnap-for-woocommerce.php")
  • Text Domain: The text domain must be the same as the plugin slug, although optional since WordPress version 4.6
  • Requires at least: Required version must match the one declared in readme.txt ("5.2.4" instead of "3.7.0")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short check of programming languages and file extensions; no executable files are allowed
There were no executable files found in this plugin10,368 lines of code in 67 files:
LanguageFilesBlank linesComment linesLines of code
PHP481,7172,8067,334
JavaScript124082142,782
Sass2140139
CSS4813110
JSON1003

PHP code Passed 2 tests

This plugin's cyclomatic complexity and code structure detailed below
This plugin has no cyclomatic complexity issues
Cyclomatic complexity
Average complexity per logical line of code0.51
Average class complexity41.42
▷ Minimum class complexity1.00
▷ Maximum class complexity236.00
Average method complexity4.13
▷ Minimum method complexity1.00
▷ Maximum method complexity44.00
Code structure
Namespaces0
Interfaces0
Traits1
Classes30
▷ Abstract classes310.00%
▷ Concrete classes2790.00%
▷ Final classes13.70%
Methods406
▷ Static methods7418.23%
▷ Public methods28770.69%
▷ Protected methods7919.46%
▷ Private methods409.85%
Functions10
▷ Named functions880.00%
▷ Anonymous functions220.00%
Constants46
▷ Global constants1328.26%
▷ Class constants3371.74%
▷ Public constants33100.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.02MB with 0.00MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/images/cb.png4.14KB1.60KB▼ 61.50%
assets/images/diners.png0.76KB0.74KB▼ 1.80%
assets/images/amex.png1.16KB1.16KB0.00%
assets/images/generic-card.png0.82KB0.59KB▼ 27.62%
assets/images/mastercard.png0.68KB0.68KB0.00%