77% bbmsl-payment-gateway

Code Review | BBMSL Payment Gateway

WordPress plugin BBMSL Payment Gateway scored77%from 54 tests.

About plugin

  • Plugin page: bbmsl-payment-gat...
  • Plugin version: 1.0.21
  • PHP compatiblity: 7.4+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.3-6.3.1
  • WordPress version: 6.3.1
  • First release: Sep 13, 2022
  • Latest release: Oct 13, 2023
  • Number of updates: 24
  • Update frequency: every 16.8 days
  • Top authors: bbmsl (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /379 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Verifying that this plugin installs correctly without errors
Install script ran successfully

Server metrics [RAM: ▲0.97MB] [CPU: ▲8.54ms] Passed 4 tests

Server-side resources used by BBMSL Payment Gateway
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /4.45 ▲0.9851.20 ▲13.19
Dashboard /wp-admin4.29 ▲0.9463.61 ▲4.72
Posts /wp-admin/edit.php4.41 ▲1.0562.08 ▲11.96
Add New Post /wp-admin/post-new.php6.88 ▲0.9895.33 ▲4.30
Media Library /wp-admin/upload.php4.22 ▲0.9848.53 ▲14.84
BBMSL Settings /wp-admin/admin.php?page=bbmsl-settings-download-logs4.1642.42
BBMSL Settings /wp-admin/admin.php?page=bbmsl-settings-reset-settings4.1644.17
BBMSL Settings /wp-admin/admin.php?page=bbmsl-settings-server-info4.2347.10

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

Analyzing filesystem and database footprints of this plugin
The plugin installed successfully
Filesystem: 683 new files
Database: no new tables, 34 new options
New WordPress options
bbmsl_gateway_refund
theysaidso_admin_options
bbmsl_status_on_create
bbmsl_thank_you_page
bbmsl_db_version
bbmsl_display_name
widget_recent-posts
bbmsl_show_language_tools_enabled
bbmsl_description_tc
bbmsl_wc_order_columns
...

Browser metrics Passed 4 tests

A check of browser resources used by BBMSL Payment Gateway
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,810 ▲2414.27 ▼0.501.67 ▼0.1542.74 ▲3.49
Dashboard /wp-admin2,209 ▲325.56 ▼0.0983.33 ▼3.7750.07 ▲7.89
Posts /wp-admin/edit.php2,117 ▲172.01 ▼0.0236.42 ▼1.2246.72 ▲9.82
Add New Post /wp-admin/post-new.php1,538 ▲1223.36 ▼0.32664.55 ▼37.5668.24 ▲7.23
Media Library /wp-admin/upload.php1,417 ▲174.24 ▲0.1098.53 ▲0.0346.68 ▲2.20
BBMSL Settings /wp-admin/admin.php?page=bbmsl-settings-download-logs5571.517.3820.09
BBMSL Settings /wp-admin/admin.php?page=bbmsl-settings-reset-settings6691.516.6924.25
BBMSL Settings /wp-admin/admin.php?page=bbmsl-settings-server-info5,9791.076.4085.05

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
The following items require your attention
  • This plugin does not fully uninstall, leaving 34 options in the database
    • widget_recent-posts
    • bbmsl_status_on_create
    • bbmsl_email_footer_content
    • bbmsl_gateway_methods
    • bbmsl_status_on_success
    • bbmsl_show_order_id
    • can_compress_scripts
    • db_upgraded
    • bbmsl_thank_you_page
    • bbmsl_show_language_tools_enabled
    • ...

Smoke tests 50% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
These errors were triggered by the plugin
  • 9 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=bbmsl-settings-reset-settings
    • > Warning in wp-includes/pluggable.php+1438
    Cannot modify header information - headers already sent by (output started at wp-includes/script-loader.php:2838)

SRP 50% from 2 tests

🔹 Tests weight: 20 | A shallow check of the single-responsibility principle; PHP files should perform no action - including output of placeholder text - and trigger no errors when accessed directly
The following issues need your attention
  • 175× GET requests to PHP files have triggered server-side errors or warnings (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'phpseclib3\\Crypt\\Common\\Formats\\Keys\\PKCS8' not found in wp-content/plugins/bbmsl-payment-gateway/vendor/phpseclib/phpseclib/phpseclib/Crypt/RSA/Formats/Keys/PKCS8.php:37
    • > PHP Fatal error
      Uncaught Error: Class 'phpseclib3\\Math\\Common\\FiniteField\\Integer' not found in wp-content/plugins/bbmsl-payment-gateway/vendor/phpseclib/phpseclib/phpseclib/Math/PrimeField/Integer.php:24
    • > PHP Fatal error
      Uncaught Error: Class 'phpseclib3\\Crypt\\EC\\BaseCurves\\Prime' not found in wp-content/plugins/bbmsl-payment-gateway/vendor/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/secp192r1.php:21
    • > PHP Fatal error
      Uncaught Error: Class 'phpseclib3\\Crypt\\EC\\BaseCurves\\Base' not found in wp-content/plugins/bbmsl-payment-gateway/vendor/phpseclib/phpseclib/phpseclib/Crypt/EC/BaseCurves/Binary.php:33
    • > PHP Fatal error
      Uncaught Error: Class 'phpseclib3\\Crypt\\EC\\Curves\\sect409r1' not found in wp-content/plugins/bbmsl-payment-gateway/vendor/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/nistb409.php:16
    • > PHP Fatal error
      Uncaught Error: Class 'phpseclib3\\Crypt\\EC\\BaseCurves\\Binary' not found in wp-content/plugins/bbmsl-payment-gateway/vendor/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/sect239k1.php:19
    • > PHP Fatal error
      Uncaught Error: Class 'BBMSL\\Bootstrap\\Constants' not found in wp-content/plugins/bbmsl-payment-gateway/views/panes/content-settings.php:24
    • > PHP Fatal error
      Uncaught Error: Class 'WC_Payment_Gateway' not found in wp-content/plugins/bbmsl-payment-gateway/sdk/class-payment-gateway.php:29
    • > PHP Fatal error
      Uncaught Error: Class 'phpseclib3\\Crypt\\EC\\BaseCurves\\Prime' not found in wp-content/plugins/bbmsl-payment-gateway/vendor/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/brainpoolP224r1.php:19
    • > PHP Fatal error
      Trait 'phpseclib3\\System\\SSH\\Common\\Traits\\ReadBytes' not found in wp-content/plugins/bbmsl-payment-gateway/vendor/phpseclib/phpseclib/phpseclib/System/SSH/Agent.php on line 49

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
Everything seems fine, but this is not an exhaustive test

Optimizations

Plugin configuration 83% from 29 tests

readme.txt 81% from 16 tests

The readme.txt file is undoubtedly the most important file in your plugin, preparing it for public listing on WordPress.org
Attributes that need to be fixed:
  • Screenshots: These screenshots need descriptions #1, #2 in bbmsl-payment-gateway/assets to your readme.txt
  • License uri: Please fix this invalid url: ""
  • Donate link: Please fix this invalid url: ""
The official readme.txt is a good inspiration

bbmsl-payment-gateway/bbmsl.php 85% from 13 tests

The primary PHP file in "BBMSL Payment Gateway" version 1.0.21 is used by WordPress to initiate all plugin functionality
It is important to fix the following:
  • Main file name: Even though not officially enforced, the main plugin file should be the same as the plugin slug ("bbmsl-payment-gateway.php" instead of "bbmsl.php")
  • Text Domain: You no longer need to specify the text domain since WordPress 4.6; it must be the same as the plugin slug

Code Analysis 97% from 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short review of files and their extensions; it is not recommended to include executable files
No dangerous file extensions were detected77,697 lines of code in 551 files:
LanguageFilesBlank linesComment linesLines of code
PHP3917,30024,02539,484
JavaScript101146424,482
PO File112,1122,4395,765
SVG15003,811
TypeScript1003,116
JSON500431
CSS181920312
Markdown5850179
YAML23295
XML10019
Bourne Shell1203

PHP code 50% from 2 tests

This is a short overview of cyclomatic complexity and code structure for this plugin
Please fix the following
  • Cyclomatic complexity of methods should be reduced to less than 100 (currently 104)
Cyclomatic complexity
Average complexity per logical line of code0.40
Average class complexity17.76
▷ Minimum class complexity1.00
▷ Maximum class complexity679.00
Average method complexity4.41
▷ Minimum method complexity1.00
▷ Maximum method complexity104.00
Code structure
Namespaces46
Interfaces3
Traits4
Classes365
▷ Abstract classes20856.99%
▷ Concrete classes15743.01%
▷ Final classes2817.83%
Methods1,760
▷ Static methods74242.16%
▷ Public methods1,28573.01%
▷ Protected methods21612.27%
▷ Private methods25914.72%
Functions55
▷ Named functions23.64%
▷ Anonymous functions5396.36%
Constants493
▷ Global constants71.42%
▷ Class constants48698.58%
▷ Public constants47798.15%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
47 PNG files occupy 3.52MB with 2.30MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
public/images/instruction/generate_key.png39.22KB16.67KB▼ 57.50%
public/images/instruction/eshop_express_checkout_en.png86.33KB28.04KB▼ 67.52%
public/images/instruction/gateway_express_checkout.png149.86KB44.50KB▼ 70.31%
public/images/instruction/admin_refund_function_en.png80.41KB31.53KB▼ 60.79%
public/images/instruction/gateway_show_button_background_color.png63.23KB18.93KB▼ 70.06%