74% cardgate

Code Review | CardGate Payments for WooCommerce

WordPress plugin CardGate Payments for WooCommerce scored74%from 54 tests.

About plugin

  • Plugin page: cardgate
  • Plugin version: 3.1.26
  • PHP version: 7.4.16
  • WordPress compatibility: 4.4-6.2
  • WordPress version: 6.3.1
  • First release: Jul 17, 2017
  • Latest release: Oct 5, 2023
  • Number of updates: 72
  • Update frequency: every 41.0 days
  • Top authors: CardGate (100%)

Code review

54 tests

User reviews

4 reviews

Install metrics

400+ active /12,298 total downloads

Benchmarks

Plugin footprint 65% 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.15MB] [CPU: ▼4.44ms] Passed 4 tests

This is a short check of server-side resources used by CardGate Payments for WooCommerce
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /3.64 ▲0.1740.77 ▲1.09
Dashboard /wp-admin3.46 ▲0.1149.54 ▼8.73
Posts /wp-admin/edit.php3.58 ▲0.2150.73 ▲0.75
Add New Post /wp-admin/post-new.php6.04 ▲0.1582.43 ▼10.86
Media Library /wp-admin/upload.php3.38 ▲0.1546.11 ▲13.14
Payments Table /wp-admin/admin.php?page=cardgate_payments_table3.4639.03
Settings /wp-admin/admin.php?page=cardgate_menu3.3541.21

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

Analyzing filesystem and database footprints of this plugin
There were no storage issued detected upon installing this plugin
Filesystem: 50 new files
Database: 1 new table, 8 new options
New tables
wp_cardgate_payments
New WordPress options
db_upgraded
theysaidso_admin_options
widget_recent-comments
cgp_version
widget_recent-posts
widget_theysaidso_widget
cardgate_version
can_compress_scripts

Browser metrics Passed 4 tests

An overview of browser requirements for CardGate Payments for WooCommerce
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,832 ▲6114.25 ▼0.021.53 ▼0.2837.00 ▲0.43
Dashboard /wp-admin2,235 ▲555.56 ▼0.0886.16 ▼1.9673.79 ▲35.04
Posts /wp-admin/edit.php2,141 ▲382.00 ▲0.0235.49 ▼5.8031.98 ▼6.84
Add New Post /wp-admin/post-new.php1,718 ▲19022.21 ▼0.96680.19 ▼4.6552.00 ▼15.50
Media Library /wp-admin/upload.php1,440 ▲374.12 ▼0.0895.90 ▼4.8071.13 ▲25.71
Payments Table /wp-admin/admin.php?page=cardgate_payments_table9612.1627.0731.16
Settings /wp-admin/admin.php?page=cardgate_menu1,0172.1624.5428.39

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

🔸 Tests weight: 35 | All plugins must uninstall correctly, removing their source code and extra database tables they might have created
These items require your attention
  • This plugin does not fully uninstall, leaving 1 table in the database
    • wp_cardgate_payments
  • Zombie WordPress options were found after uninstall: 8 options
    • widget_recent-posts
    • db_upgraded
    • cardgate_version
    • widget_theysaidso_widget
    • can_compress_scripts
    • cgp_version
    • widget_recent-comments
    • theysaidso_admin_options

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 | 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
  • 33× PHP files trigger errors when accessed directly with GET requests (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'CGP_Common_Gateway' not found in wp-content/plugins/cardgate/classes/WC_CardgateIdealqr.php:11
    • > PHP Fatal error
      Uncaught Error: Class 'CGP_Common_Gateway' not found in wp-content/plugins/cardgate/classes/WC_CardgatePaysafecash.php:11
    • > PHP Fatal error
      Uncaught Error: Class 'CGP_Common_Gateway' not found in wp-content/plugins/cardgate/classes/WC_CardgateSpraypay.php:11
    • > PHP Fatal error
      Uncaught Error: Class 'CGP_Common_Gateway' not found in wp-content/plugins/cardgate/classes/WC_CardgateAfterpay.php:11
    • > PHP Fatal error
      Uncaught Error: Class 'CGP_Common_Gateway' not found in wp-content/plugins/cardgate/classes/WC_CardgateOnlineueberweisen.php:11
    • > PHP Fatal error
      Uncaught Error: Class 'CGP_Common_Gateway' not found in wp-content/plugins/cardgate/classes/WC_CardgateGiropay.php:11
    • > PHP Fatal error
      Uncaught Error: Class 'CGP_Common_Gateway' not found in wp-content/plugins/cardgate/classes/WC_CardgateSofortbanking.php:11
    • > PHP Fatal error
      Uncaught Error: Class 'WP_List_Table' not found in wp-content/plugins/cardgate/classes/Cardgate_PaymentsListTable.php:11
    • > PHP Fatal error
      Uncaught Error: Class 'CGP_Common_Gateway' not found in wp-content/plugins/cardgate/classes/WC_CardgatePaysafecard.php:11
    • > PHP Fatal error
      Uncaught Error: Class 'cardgate\\api\\Entity' not found in wp-content/plugins/cardgate/cardgate-clientlib-php/src/Item.php:78

User-side errors Passed 1 test

🔹 Test weight: 20 | This is just a short smoke test looking for browser issues
There were no browser issues found

Optimizations

Plugin configuration 97% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file is an important file in your plugin as it is parsed by WordPress.org to prepare the public listing of your plugin
These attributes need to be fixed:
  • Tags: Too many tags (12 tag instead of maximum 10); only the first 5 tags are used in your directory listing
The official readme.txt is a good inspiration

cardgate/cardgate.php Passed 13 tests

The principal PHP file in "CardGate Payments for WooCommerce" v. 3.1.26 is loaded by WordPress automatically on each request
58 characters long description:
Integrates Cardgate Gateway for WooCommerce into WordPress

Code Analysis Passed 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
There were no executable files found in this plugin3,265 lines of code in 43 files:
LanguageFilesBlank linesComment linesLines of code
PHP416932,3173,126
PO File15153134
JavaScript1005

PHP code Passed 2 tests

This plugin's cyclomatic complexity and code structure detailed below
There were no cyclomatic complexity issued detected
Cyclomatic complexity
Average complexity per logical line of code0.31
Average class complexity11.78
▷ Minimum class complexity1.00
▷ Maximum class complexity115.00
Average method complexity3.08
▷ Minimum method complexity1.00
▷ Maximum method complexity52.00
Code structure
Namespaces2
Interfaces0
Traits0
Classes40
▷ Abstract classes12.50%
▷ Concrete classes3997.50%
▷ Final classes1435.90%
Methods207
▷ Static methods62.90%
▷ Public methods19694.69%
▷ Protected methods00.00%
▷ Private methods115.31%
Functions1
▷ Named functions1100.00%
▷ Anonymous functions00.00%
Constants35
▷ Global constants00.00%
▷ Class constants35100.00%
▷ Public constants35100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

It is recommended to compress PNG files in your plugin to minimize bandwidth usage
4 PNG files occupy 0.02MB with 0.01MB in potential savings
Potential savings
Compression of 4 random PNG files using pngquant
FileSize - originalSize - compressedSavings
images/cgp_icon-16x16_color.png1.30KB0.63KB▼ 51.65%
images/cgp_icon-16x16.png0.44KB0.62KB0.00%
images/cardgate.png22.06KB11.59KB▼ 47.44%
images/cgp_icon-16x16_bw.png0.44KB0.62KB0.00%