73% choice-payment-gateway-for-woocommerce

Code Review | Choice Payment Gateway for WooCommerce

WordPress plugin Choice Payment Gateway for WooCommerce scored73%from 54 tests.

About plugin

  • Plugin page: choice-payment-ga...
  • Plugin version: 2.1.2
  • PHP compatiblity: 7.3+
  • PHP version: 7.4.16
  • WordPress compatibility: 5.5-6.1.1
  • WordPress version: 6.3.1
  • First release: Sep 24, 2021
  • Latest release: Nov 23, 2022
  • Number of updates: 30
  • Update frequency: every 14.2 days
  • Top authors: versacomp (100%)

Code review

54 tests

User reviews

1 review

Install metrics

20+ active /1,050 total downloads

Benchmarks

Plugin footprint 65% from 16 tests

Installer Passed 1 test

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

Server metrics [RAM: ▲4.67MB] [CPU: ▲12.23ms] 75% from 4 tests

Server-side resources used by Choice Payment Gateway for WooCommerce
Please fix the following
  • CPU: Try to keep total CPU usage under 500.00ms (currently 1,633.17ms on /wp-admin/admin.php?page=choice-payment-gateway-for-woocommerce)
PageMemory (MB)CPU Time (ms)
Home /8.53 ▲5.0752.74 ▲16.06
Dashboard /wp-admin8.55 ▲5.2566.24 ▲19.80
Posts /wp-admin/edit.php8.55 ▲5.2064.76 ▲17.06
Add New Post /wp-admin/post-new.php9.05 ▲3.1799.83 ▼4.02
Media Library /wp-admin/upload.php8.55 ▲5.3260.71 ▲27.77
Freemius Debug [v.2.4.3] /wp-admin/admin.php?page=freemius8.5561.08
Choice Payment Gateway for WooCommerce /wp-admin/admin.php?page=choice-payment-gateway-for-woocommerce8.551,633.17

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

Input-output and database impact of this plugin
This plugin was installed successfully
Filesystem: 243 new files
Database: no new tables, 10 new options
New WordPress options
widget_theysaidso_widget
fs_accounts
widget_recent-posts
widget_recent-comments
fs_gdpr
can_compress_scripts
theysaidso_admin_options
fs_debug_mode
fs_active_plugins
db_upgraded

Browser metrics Passed 4 tests

Choice Payment Gateway for WooCommerce: an overview of browser usage
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,486 ▼28513.36 ▼1.020.46 ▼1.618.13 ▼32.81
Dashboard /wp-admin2,230 ▲394.86 ▼0.04107.48 ▲5.9441.18 ▼2.33
Posts /wp-admin/edit.php2,110 ▲242.00 ▼0.0436.31 ▲2.7133.52 ▲1.02
Add New Post /wp-admin/post-new.php1,531 ▼518.15 ▼5.06636.73 ▼8.3963.01 ▲4.10
Media Library /wp-admin/upload.php1,409 ▲214.24 ▼0.0398.61 ▼7.9748.24 ▲0.90
Freemius Debug [v.2.4.3] /wp-admin/admin.php?page=freemius1,0531.6824.0328.81
Choice Payment Gateway for WooCommerce /wp-admin/admin.php?page=choice-payment-gateway-for-woocommerce9991.6927.2849.85

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

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
These items require your attention
  • Uninstall procedure validation failed for this plugin
    • > Notice in wp-content/plugins/choice-payment-gateway-for-woocommerce/freemius/includes/class-freemius.php+8575
    Undefined property: stdClass::$plugins
  • Zombie WordPress options were found after uninstall: 10 options
    • fs_active_plugins
    • db_upgraded
    • fs_debug_mode
    • widget_recent-posts
    • widget_recent-comments
    • can_compress_scripts
    • widget_theysaidso_widget
    • fs_gdpr
    • theysaidso_admin_options
    • fs_accounts

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no server-side errors were triggered
Everything seems fine, however this is by no means an exhaustive test

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
Please fix the following
  • 16× PHP files trigger errors when accessed directly with GET requests (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'Defuse\\Crypto\\Crypto' not found in wp-content/plugins/choice-payment-gateway-for-woocommerce/vendor/defuse/php-encryption/src/RuntimeTests.php:14
    • > PHP Fatal error
      Uncaught Error: Class 'WC_Payment_Gateway' not found in wp-content/plugins/choice-payment-gateway-for-woocommerce/classes/WC_Gateway_Choice_Subscription.php:6
    • > PHP Fatal error
      Uncaught Error: Class 'Defuse\\Crypto\\Exception\\CryptoException' not found in wp-content/plugins/choice-payment-gateway-for-woocommerce/vendor/defuse/php-encryption/src/Exception/WrongKeyOrModifiedCiphertextException.php:5
    • > PHP Fatal error
      Uncaught Error: Using $this when not in object context in wp-content/plugins/choice-payment-gateway-for-woocommerce/templates/payment-fields.php:2
    • > PHP Fatal error
      Uncaught Error: Class 'Defuse\\Crypto\\Exception\\CryptoException' not found in wp-content/plugins/choice-payment-gateway-for-woocommerce/vendor/defuse/php-encryption/src/Exception/BadFormatException.php:5
    • > PHP Fatal error
      Uncaught Error: Class 'WC_Gateway_Choice_Paynt' not found in wp-content/plugins/choice-payment-gateway-for-woocommerce/classes/class-wc-gateway-choice-subscription.php:8
    • > PHP Fatal error
      Uncaught Error: Class 'WC_Gateway_Choice_BankClearing' not found in wp-content/plugins/choice-payment-gateway-for-woocommerce/classes/WC_Gateway_Choice_BankClearing_Subscriptions.php:17
    • > PHP Fatal error
      Uncaught Error: Class 'WC_Payment_Gateway' not found in wp-content/plugins/choice-payment-gateway-for-woocommerce/classes/class-wc-gateway-choice-paynt.php:29
    • > PHP Fatal error
      Uncaught Error: Using $this when not in object context in wp-content/plugins/choice-payment-gateway-for-woocommerce/templates/payment-fields-ach.php:2
    • > PHP Fatal error
      Uncaught UnexpectedValueException: creating archive "wp-content/plugins/choice-payment-gateway-for-woocommerce/vendor/paragonie/random_compat/dist/random_compat.phar" disabled by the php.ini setting phar.readonly in /var/www/wordpress/wp-content/plugins/choice-payment-gateway-for-woocommerce/vendor/paragonie/random_compat/other/build_phar.php:12

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 errors were detected

Optimizations

Plugin configuration 96% 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
5 plugin tags: woocommerce payment, payment processing, choice woocommerce, cash discount, ach

choice-payment-gateway-for-woocommerce/woo-choice-payment-gateway.php 92% from 13 tests

This is the main PHP file of "Choice Payment Gateway for WooCommerce" version 2.1.2, providing information about the plugin in the header fields and serving as the principal entry point to the plugin's functions
The following require your attention:
  • Main file name: Please rename the main PHP file in this plugin to the plugin slug ("choice-payment-gateway-for-woocommerce.php" instead of "woo-choice-payment-gateway.php")

Code Analysis 97% from 3 tests

File types Passed 1 test

🔸 Test weight: 35 | This is a short overview of programming languages used in this plugin, detecting executable files
Good job! No executable or dangerous file extensions detected37,533 lines of code in 191 files:
LanguageFilesBlank linesComment linesLines of code
PHP1528,25717,75734,953
Markdown1363901,681
JavaScript49180540
JSON600254
CSS121139
make19426
XML10019
SVG10118
Bourne Shell1203

PHP code 50% from 2 tests

This plugin's cyclomatic complexity and code structure detailed below
It is recommended to fix the following
  • Class cyclomatic complexity should be reduced to less than 1000 (currently 2,910)
Cyclomatic complexity
Average complexity per logical line of code0.59
Average class complexity62.17
▷ Minimum class complexity1.00
▷ Maximum class complexity2,910.00
Average method complexity4.45
▷ Minimum method complexity1.00
▷ Maximum method complexity86.00
Code structure
Namespaces5
Interfaces0
Traits1
Classes74
▷ Abstract classes22.70%
▷ Concrete classes7297.30%
▷ Final classes79.72%
Methods1,363
▷ Static methods25518.71%
▷ Public methods99172.71%
▷ Protected methods292.13%
▷ Private methods34325.17%
Functions96
▷ Named functions9598.96%
▷ Anonymous functions11.04%
Constants188
▷ Global constants9952.66%
▷ Class constants8947.34%
▷ Public constants89100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

PNG files should be compressed to save space and minimize bandwidth usage
2 PNG files occupy 0.02MB with 0.01MB in potential savings
Potential savings
Compression of 2 random PNG files using pngquant
FileSize - originalSize - compressedSavings
freemius/assets/img/theme-icon.png10.97KB5.78KB▼ 47.37%
freemius/assets/img/plugin-icon.png9.16KB5.26KB▼ 42.58%