83% hitpay-payment-gateway

Code Review | HitPay Payment Gateway for WooCommerce

WordPress plugin HitPay Payment Gateway for WooCommerce scored83%from 54 tests.

About plugin

  • Plugin page: hitpay-payment-ga...
  • Plugin version: 4.0.9
  • PHP compatiblity: 5.5+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.0-6.2.2
  • WordPress version: 6.3.1
  • First release: Mar 7, 2021
  • Latest release: Sep 27, 2023
  • Number of updates: 55
  • Update frequency: every 17.0 days
  • Top authors: hitpay2020 (100%)

Code review

54 tests

User reviews

1 review

Install metrics

3,000+ active /15,209 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
Installer ran successfully

Server metrics [RAM: ▲0.01MB] [CPU: ▼4.03ms] Passed 4 tests

Server-side resources used by HitPay Payment Gateway for WooCommerce
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /3.47 ▲0.0142.15 ▼0.70
Dashboard /wp-admin3.31 ▲0.0154.51 ▲2.73
Posts /wp-admin/edit.php3.36 ▲0.0148.51 ▼0.62
Add New Post /wp-admin/post-new.php5.89 ▲0.0186.66 ▼16.78
Media Library /wp-admin/upload.php3.24 ▲0.0140.00 ▲1.98

Server storage [IO: ▲4.07MB] [DB: ▲0.07MB] Passed 3 tests

How much does this plugin use your filesystem and database?
The plugin installed successfully
Filesystem: 260 new files
Database: no new tables, 6 new options
New WordPress options
widget_recent-posts
theysaidso_admin_options
widget_recent-comments
db_upgraded
can_compress_scripts
widget_theysaidso_widget

Browser metrics Passed 4 tests

Checking browser requirements for HitPay Payment Gateway for WooCommerce
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,789 ▲2814.38 ▲0.101.70 ▼0.1742.56 ▼2.60
Dashboard /wp-admin2,198 ▲215.60 ▼0.1092.62 ▲0.0940.51 ▼2.45
Posts /wp-admin/edit.php2,100 ▲32.00 ▼0.0240.08 ▲2.8537.57 ▲1.91
Add New Post /wp-admin/post-new.php1,546 ▲1423.15 ▼0.20668.51 ▼23.7555.73 ▲3.71
Media Library /wp-admin/upload.php1,397 ▲64.23 ▲0.02108.10 ▲9.7247.31 ▲4.71

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

🔸 Tests weight: 35 | It is important to correctly uninstall your plugin, without leaving any traces
You still need to fix the following
  • This plugin does not fully uninstall, leaving 6 options in the database
    • widget_theysaidso_widget
    • db_upgraded
    • widget_recent-comments
    • widget_recent-posts
    • can_compress_scripts
    • theysaidso_admin_options

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
Even though everything seems fine, this is not an exhaustive test

SRP 50% from 2 tests

🔹 Tests weight: 20 | It is important to ensure that your PHP files perform no action when accessed directly, respecting the single-responsibility principle
Please fix the following items
  • 12× GET requests to PHP files trigger server-side errors or Error 500 responses (only 10 are shown):
    • > PHP Fatal error
      require_once(): Failed opening required '../vendor/autoload.php' (include_path='.:/usr/share/php') in wp-content/plugins/hitpay-payment-gateway/vendor/softbuild/hitpay-sdk/Examples/ClientExample.php on line 3
    • > PHP Fatal error
      Uncaught Error: Class 'HitPay\\Request' not found in wp-content/plugins/hitpay-payment-gateway/vendor/softbuild/hitpay-sdk/src/Client.php:15
    • > PHP Fatal error
      Uncaught Error: Class 'WC_Payment_Gateway' not found in wp-content/plugins/hitpay-payment-gateway/includes/regular-checkout.php:14
    • > PHP Fatal error
      Uncaught Error: Class 'WC_Payment_Gateway' not found in wp-content/plugins/hitpay-payment-gateway/trunk/includes/regular-checkout.php:14
    • > PHP Warning
      require_once(../vendor/autoload.php): failed to open stream: No such file or directory in wp-content/plugins/hitpay-payment-gateway/trunk/vendor/softbuild/hitpay-sdk/Examples/ClientExample.php on line 3
    • > PHP Warning
      require_once(../vendor/autoload.php): failed to open stream: No such file or directory in wp-content/plugins/hitpay-payment-gateway/vendor/softbuild/hitpay-sdk/Examples/ClientExample.php on line 3
    • > PHP Fatal error
      Uncaught Error: Class 'HitPay\\Request' not found in wp-content/plugins/hitpay-payment-gateway/trunk/vendor/softbuild/hitpay-sdk/src/Client.php:15
    • > PHP Fatal error
      Uncaught Error: Class 'HitPay\\Response\\CreatePayment' not found in wp-content/plugins/hitpay-payment-gateway/vendor/softbuild/hitpay-sdk/src/Response/PaymentStatus.php:10
    • > PHP Fatal error
      Uncaught Error: Class 'Automattic\\WooCommerce\\Blocks\\Payments\\Integrations\\AbstractPaymentMethodType' not found in wp-content/plugins/hitpay-payment-gateway/trunk/includes/blocks-checkout.php:14
    • > PHP Fatal error
      Uncaught Error: Class 'HitPay\\Response\\CreatePayment' not found in wp-content/plugins/hitpay-payment-gateway/trunk/vendor/softbuild/hitpay-sdk/src/Response/PaymentStatus.php:10

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 93% from 29 tests

readme.txt 94% from 16 tests

It's important to format your readme.txt file correctly as it is parsed for the public listing of your plugin
These attributes need to be fixed: The official readme.txt might help

hitpay-payment-gateway/hitpay-payment-gateway.php 92% from 13 tests

The main file in "HitPay Payment Gateway for WooCommerce" v. 4.0.9 serves as a complement to information provided in readme.txt and as the entry point to the plugin
Please make the necessary changes and fix the following:
  • Description: Please don't use more than 140 characters for the plugin description (currently 212 characters long)

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | Executable files are considered dangerous and should not be included with any WordPress plugin
There were no executable files found in this plugin3,346 lines of code in 75 files:
LanguageFilesBlank linesComment linesLines of code
PHP225358822,594
SVG4601482
JavaScript221098
CSS111093
JSON20057
Dockerfile13115
YAML1107

PHP code Passed 2 tests

An short overview of logical lines of code, cyclomatic complexity, and other code metrics
No complexity issues detected
Cyclomatic complexity
Average complexity per logical line of code0.26
Average class complexity19.15
▷ Minimum class complexity1.00
▷ Maximum class complexity136.00
Average method complexity2.41
▷ Minimum method complexity1.00
▷ Maximum method complexity19.00
Code structure
Namespaces4
Interfaces0
Traits0
Classes26
▷ Abstract classes00.00%
▷ Concrete classes26100.00%
▷ Final classes27.69%
Methods336
▷ Static methods82.38%
▷ Public methods31894.64%
▷ Protected methods61.79%
▷ Private methods123.57%
Functions30
▷ Named functions2686.67%
▷ Anonymous functions413.33%
Constants78
▷ Global constants6684.62%
▷ Class constants1215.38%
▷ Public constants12100.00%

Plugin size 0% from 2 tests

Image compression 0% from 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
80 PNG files occupy 2.79MB with 1.82MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
trunk/assets/screenshots/6-Drop-in_Enable.png120.92KB38.58KB▼ 68.09%
assets/images/wechat.png2.84KB1.56KB▼ 45.16%
assets/images/psbank.png5.25KB2.24KB▼ 57.24%
(invalid) assets/images/chinabank.png133.29KB0.00KB▼ 100.00%
assets/screenshots/4.png63.02KB27.61KB▼ 56.19%