84% tradesafe-payment-gateway

Code Review | TradeSafe Payment Gateway for WooCommerce

WordPress plugin TradeSafe Payment Gateway for WooCommerce scored84%from 54 tests.

About plugin

  • Plugin page: tradesafe-payment...
  • Plugin version: 2.13.4
  • PHP compatiblity: 7.4+
  • PHP version: 7.4.16
  • WordPress compatibility: 5.5-6.3
  • WordPress version: 6.3.1
  • First release: Jun 11, 2021
  • Latest release: Oct 30, 2023
  • Number of updates: 106
  • Update frequency: every 8.2 days
  • Top authors: tradesafeops (100%)

Code review

54 tests

User reviews

2 reviews

Install metrics

30+ active /5,179 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.05MB] [CPU: ▼3.33ms] Passed 4 tests

A check of server-side resources used by TradeSafe Payment Gateway for WooCommerce
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /3.52 ▲0.0539.81 ▲3.74
Dashboard /wp-admin3.36 ▲0.0549.51 ▼9.94
Posts /wp-admin/edit.php3.41 ▲0.0545.94 ▲1.90
Add New Post /wp-admin/post-new.php5.94 ▲0.0581.96 ▼5.13
Media Library /wp-admin/upload.php3.28 ▲0.0533.46 ▼0.13

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

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

Browser metrics Passed 4 tests

An overview of browser requirements for TradeSafe Payment Gateway for WooCommerce
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,789 ▲2814.24 ▼0.111.82 ▲0.2743.89 ▲3.59
Dashboard /wp-admin2,195 ▲185.62 ▲0.0892.65 ▲1.7141.86 ▲1.44
Posts /wp-admin/edit.php2,100 ▼01.97 ▼0.0432.56 ▼3.0933.89 ▼1.94
Add New Post /wp-admin/post-new.php1,531 ▲523.22 ▲0.10667.85 ▼3.2655.90 ▲3.00
Media Library /wp-admin/upload.php1,400 ▲64.25 ▲0.0498.01 ▼4.5542.05 ▼1.61

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

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
These items require your attention
  • This plugin did not uninstall successfully, leaving 6 options in the database
    • theysaidso_admin_options
    • widget_theysaidso_widget
    • db_upgraded
    • widget_recent-posts
    • widget_recent-comments
    • can_compress_scripts

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the server (in the Apache logs)
Good news, no errors were detected

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
Almost there! Just fix the following items
  • 94× GET requests to PHP files trigger server-side errors or Error 500 responses (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'Symfony\\Polyfill\\Php80\\PhpToken' not found in wp-content/plugins/tradesafe-payment-gateway/vendor/symfony/polyfill-php80/Resources/stubs/PhpToken.php:13
    • > PHP Fatal error
      Uncaught Error: Interface 'Psr\\Http\\Message\\StreamInterface' not found in wp-content/plugins/tradesafe-payment-gateway/vendor/guzzlehttp/psr7/src/InflateStream.php:20
    • > PHP Fatal error
      Uncaught Error: Interface 'GuzzleHttp\\MessageFormatterInterface' not found in wp-content/plugins/tradesafe-payment-gateway/vendor/guzzlehttp/guzzle/src/MessageFormatter.php:38
    • > PHP Fatal error
      Uncaught Error: Class 'GuzzleHttp\\Promise\\RejectionException' not found in wp-content/plugins/tradesafe-payment-gateway/vendor/guzzlehttp/promises/src/AggregateException.php:10
    • > PHP Fatal error
      Uncaught Error: Interface 'Psr\\Http\\Client\\ClientInterface' not found in wp-content/plugins/tradesafe-payment-gateway/vendor/gmostafa/php-graphql-client/src/Util/GuzzleAdapter.php:11
    • > PHP Fatal error
      Uncaught Error: Class 'GraphQL\estableObject' not found in wp-content/plugins/tradesafe-payment-gateway/vendor/gmostafa/php-graphql-client/src/InlineFragment.php:12
    • > PHP Fatal error
      Uncaught Error: Class 'GuzzleHttp\\Exception\\TransferException' not found in wp-content/plugins/tradesafe-payment-gateway/vendor/guzzlehttp/guzzle/src/Exception/ConnectException.php:13
    • > PHP Fatal error
      Uncaught Error: Class 'League\\OAuth2\\Client\\OptionProvider\\PostAuthOptionProvider' not found in wp-content/plugins/tradesafe-payment-gateway/vendor/league/oauth2-client/src/OptionProvider/HttpBasicAuthOptionProvider.php:23
    • > PHP Fatal error
      Uncaught Error: Interface 'League\\OAuth2\\Client\\Token\\AccessTokenInterface' not found in wp-content/plugins/tradesafe-payment-gateway/vendor/league/oauth2-client/src/Token/ResourceOwnerAccessTokenInterface.php:17
    • > PHP Warning
      require_once(wp-content/plugins/tradesafe-payment-gateway/vendor/gmostafa/php-graphql-client/examples/../vendor/autoload.php): failed to open stream: No such file or directory in wp-content/plugins/tradesafe-payment-gateway/vendor/gmostafa/php-graphql-client/examples/query_example.php on line 3

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)
Everything seems fine, but this is not an exhaustive test

Optimizations

Plugin configuration 93% from 29 tests

readme.txt Passed 16 tests

The readme.txt file is important because it is parsed by WordPress.org for the public listing of your plugin
8 plugin tags: bnpl, woocommerce, credit card, payment gateway, escrow...

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

"TradeSafe Payment Gateway for WooCommerce" version 2.13.4's main PHP file describes plugin functionality and also serves as the entry point to any WordPress functionality
The following require your attention:
  • Requires at least: Required version must match the one declared in readme.txt ("5.6" instead of "5.5")
  • Description: Keep the plugin description shorter than 140 characters (currently 227 characters long)

Code Analysis Passed 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
There were no executable files found in this plugin21,447 lines of code in 231 files:
LanguageFilesBlank linesComment linesLines of code
PHP2083,6458,62417,322
Markdown151,11003,076
JSON100906
JavaScript218293
CSS14024
XML10019
SVG2004
Bourne Shell1203

PHP code Passed 2 tests

An short overview of logical lines of code, cyclomatic complexity, and other code metrics
This plugin has no cyclomatic complexity issues
Cyclomatic complexity
Average complexity per logical line of code0.39
Average class complexity11.03
▷ Minimum class complexity1.00
▷ Maximum class complexity99.00
Average method complexity2.66
▷ Minimum method complexity1.00
▷ Maximum method complexity33.00
Code structure
Namespaces27
Interfaces33
Traits11
Classes137
▷ Abstract classes42.92%
▷ Concrete classes13397.08%
▷ Final classes3727.82%
Methods1,130
▷ Static methods20017.70%
▷ Public methods93082.30%
▷ Protected methods786.90%
▷ Private methods12210.80%
Functions130
▷ Named functions3426.15%
▷ Anonymous functions9673.85%
Constants85
▷ Global constants33.53%
▷ Class constants8296.47%
▷ Public constants6680.49%

Plugin size Passed 2 tests

Image compression Passed 2 tests

PNG files should be compressed to save space and minimize bandwidth usage
1 PNG file occupies 0.28MB with 0.19MB in potential savings
Potential savings
Compression of 1 random PNG file using pngquant
FileSize - originalSize - compressedSavings
assets/images/banner-772x250.png289.98KB97.71KB▼ 66.30%