84% payhub-payment-gateway-for-woocommerce

Code Review | PayHub Plugin For WooCommerce

WordPress plugin PayHub Plugin For WooCommerce scored84%from 54 tests.

About plugin

  • Plugin page: payhub-payment-ga...
  • Plugin version: 1.0.17
  • PHP version: 7.4.16
  • WordPress compatibility: 3.5-4.6.1
  • WordPress version: 6.3.1
  • First release: Feb 21, 2013
  • Latest release: Mar 23, 2017
  • Number of updates: 46
  • Update frequency: every 32.7 days
  • Top authors: payhub (100%)

Code review

54 tests

User reviews

1 review

Install metrics

20+ active /2,841 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | All plugins must install correctly, without throwing any errors, warnings, or notices
Installer ran successfully

Server metrics [RAM: ▲0.59MB] [CPU: ▼10.28ms] Passed 4 tests

Server-side resources used by PayHub Plugin For WooCommerce
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /4.10 ▲0.6339.87 ▼21.39
Dashboard /wp-admin3.94 ▲0.5950.88 ▼13.00
Posts /wp-admin/edit.php3.99 ▲0.6356.03 ▲0.53
Add New Post /wp-admin/post-new.php6.46 ▲0.57101.44 ▼7.27
Media Library /wp-admin/upload.php3.80 ▲0.5742.09 ▲7.15

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

A short overview of filesystem and database impact
This plugin was installed successfully
Filesystem: 29 new files
Database: no new tables, 6 new options
New WordPress options
can_compress_scripts
db_upgraded
theysaidso_admin_options
widget_theysaidso_widget
widget_recent-comments
widget_recent-posts

Browser metrics Passed 4 tests

An overview of browser requirements for PayHub Plugin For WooCommerce
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,828 ▲8213.74 ▼0.671.85 ▲0.1139.16 ▲1.12
Dashboard /wp-admin2,209 ▲214.87 ▼0.03108.05 ▲6.2742.46 ▼0.36
Posts /wp-admin/edit.php2,095 ▲62.03 ▼0.0841.91 ▲5.2335.43 ▲1.16
Add New Post /wp-admin/post-new.php1,536 ▲323.25 ▲0.03680.01 ▲24.9157.37 ▲0.52
Media Library /wp-admin/upload.php1,388 ▲64.24 ▲0.07103.82 ▼2.2944.42 ▲1.03

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
It is recommended to fix the following
  • Zombie WordPress options detected upon uninstall: 6 options
    • widget_recent-comments
    • can_compress_scripts
    • db_upgraded
    • theysaidso_admin_options
    • widget_recent-posts
    • widget_theysaidso_widget

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a short smoke test looking for server-side errors
Even though no errors were found, this is by no means 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
  • 8× GET requests to PHP files have triggered server-side errors or warnings:
    • > PHP Fatal error
      Uncaught Error: Class 'WsConnections' not found in wp-content/plugins/payhub-payment-gateway-for-woocommerce/com/payhub/ws/model/Refund.php:9
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugin_basename() in wp-content/plugins/payhub-payment-gateway-for-woocommerce/woocommerce-payhub.php:10
    • > PHP Fatal error
      Uncaught Error: Class 'WsConnections' not found in wp-content/plugins/payhub-payment-gateway-for-woocommerce/com/payhub/ws/model/Sale.php:9
    • > PHP Fatal error
      Uncaught Error: Class 'AbstractInfo' not found in wp-content/plugins/payhub-payment-gateway-for-woocommerce/com/payhub/ws/api/CardDataInformation.php:9
    • > PHP Fatal error
      Uncaught Error: Class 'AbstractInfo' not found in wp-content/plugins/payhub-payment-gateway-for-woocommerce/com/payhub/ws/api/StatusInformation.php:9
    • > PHP Warning
      Use of undefined constant WP_PLUGIN_DIR - assumed 'WP_PLUGIN_DIR' (this will throw an Error in a future version of PHP) in wp-content/plugins/payhub-payment-gateway-for-woocommerce/woocommerce-payhub.php on line 10
    • > PHP Fatal error
      Uncaught Error: Class 'WsConnections' not found in wp-content/plugins/payhub-payment-gateway-for-woocommerce/com/payhub/ws/api/TransactionManager.php:8
    • > PHP Fatal error
      Uncaught Error: Class 'AbstractInfo' not found in wp-content/plugins/payhub-payment-gateway-for-woocommerce/com/payhub/ws/api/MerchantInformation.php:9

User-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no browser errors were triggered
No browser issues were found

Optimizations

Plugin configuration 96% from 29 tests

readme.txt Passed 16 tests

Often overlooked, readme.txt is one of the most important files in your plugin
6 plugin tags: visa, mastercard, credit card, payment, gateway...

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

Analyzing the main PHP file in "PayHub Plugin For WooCommerce" version 1.0.17
It is important to fix the following:
  • Main file name: The principal plugin file should be the same as the plugin slug ("payhub-payment-gateway-for-woocommerce.php" instead of "woocommerce-payhub.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
No dangerous file extensions were detected3,530 lines of code in 27 files:
LanguageFilesBlank linesComment linesLines of code
PHP275511,2123,530

PHP code Passed 2 tests

This is a very shot review of cyclomatic complexity and code structure
This plugin has no cyclomatic complexity problems
Cyclomatic complexity
Average complexity per logical line of code0.24
Average class complexity13.23
▷ Minimum class complexity1.00
▷ Maximum class complexity119.00
Average method complexity1.87
▷ Minimum method complexity1.00
▷ Maximum method complexity14.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes26
▷ Abstract classes13.85%
▷ Concrete classes2596.15%
▷ Final classes00.00%
Methods367
▷ Static methods205.45%
▷ Public methods36198.37%
▷ Protected methods00.00%
▷ Private methods61.63%
Functions6
▷ Named functions6100.00%
▷ Anonymous functions00.00%
Constants13
▷ Global constants00.00%
▷ Class constants13100.00%
▷ Public constants13100.00%

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.01MB with 0.01MB in potential savings
Potential savings
Compression of 1 random PNG file using pngquant
FileSize - originalSize - compressedSavings
PoweredbyPayHubCards.png9.28KB3.96KB▼ 57.36%