88% bluesnap-payment-gateway-for-woocommerce

Code Review | BlueSnap Payment Gateway for WooCommerce

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

About plugin

  • Plugin page: bluesnap-payment-...
  • Plugin version: 2.5.3
  • PHP compatiblity: 7.3+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.7.0-5.8
  • WordPress version: 5.8.1
  • First release: Sep 19, 2019
  • Latest release: Oct 20, 2021
  • Number of updates: 16
  • Update frequency: every 47.6 days
  • Top authors: harmz (100%)

Code review

54 tests

User reviews

2 reviews

Install metrics

300+ active / 3,098 total downloads

Benchmarks

Plugin footprint Passed 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: ▼144.59ms] 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 /2.91 ▲0.1938.90 ▲17.91
Dashboard /wp-admin3.14 ▲0.0850.38 ▲0.35
Posts /wp-admin/edit.php3.25 ▲0.1445.85 ▼5.34
Add New Post /wp-admin/post-new.php5.50 ▲0.07102.15 ▼570.75
Media Library /wp-admin/upload.php3.08 ▲0.0737.76 ▼2.63

Server storage [IO: ▲0.56MB] [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: 92 new files
Database: no new tables, no new options

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 /3,724 ▲12915.79 ▲0.218.92 ▲0.3549.49 ▼1.53
Dashboard /wp-admin2,981 ▲506.11 ▲0.12150.28 ▲0.76122.12 ▲3.97
Posts /wp-admin/edit.php2,752 ▲132.70 ▲0.0170.44 ▲0.3995.78 ▲0.95
Add New Post /wp-admin/post-new.php1,679 ▼418.84 ▲0.09393.52 ▼2.62107.34 ▼14.37
Media Library /wp-admin/upload.php1,759 ▼485.01 ▲0.03167.50 ▲8.01133.86 ▲9.38

Uninstaller [IO: ▲0.00MB] [DB: ▲0.00MB] Passed 4 tests

🔸 Tests weight: 35 | It is important to correctly uninstall your plugin, without leaving any traces
The plugin uninstalled successfully, without leaving any zombie files or tables

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 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: 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 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/fraud-kount-iframe.php:16
    • > 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/payment-fields-bluesnap-ach.php:14

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 93% 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: apple pay, 3d secure, payment, woocommerce, ach...

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

The main PHP file in "BlueSnap Payment Gateway for WooCommerce" ver. 2.5.3 adds more information about the plugin and also serves as the entry point for this plugin
It is important to fix the following:
  • Text Domain: The text domain must be the same as the plugin slug, although optional since WordPress version 4.6
  • 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")

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 plugin7,284 lines of code in 64 files:
LanguageFilesBlank linesComment linesLines of code
PHP451,4702,1725,562
JavaScript121841661,470
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.50
Average class complexity39.75
▷ Minimum class complexity1.00
▷ Maximum class complexity207.00
Average method complexity4.02
▷ Minimum method complexity1.00
▷ Maximum method complexity44.00
Code structure
Namespaces0
Interfaces0
Traits1
Classes27
▷ Abstract classes27.41%
▷ Concrete classes2592.59%
▷ Final classes14.00%
Methods360
▷ Static methods7119.72%
▷ Public methods26473.33%
▷ Protected methods5314.72%
▷ Private methods4311.94%
Functions10
▷ Named functions880.00%
▷ Anonymous functions220.00%
Constants45
▷ Global constants1328.89%
▷ Class constants3271.11%
▷ Public constants32100.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.03MB with 0.02MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/images/discover.png3.84KB1.25KB▼ 67.59%
assets/images/maestro.png3.59KB1.03KB▼ 71.34%
assets/images/jcb.png3.81KB1.26KB▼ 66.85%
assets/images/diners.png3.69KB0.99KB▼ 73.05%
assets/images/visa.png2.95KB1.25KB▼ 57.65%