74% cardgate

Code Review | CardGate Payments for WooCommerce

WordPress plugin CardGate Payments for WooCommerce scored 74% from 54 tests.

About plugin

  • Plugin page: cardgate
  • Plugin version: 3.1.21
  • PHP version: 7.4.16
  • WordPress compatibility: 4.4-5.7
  • WordPress version: 5.8.1
  • First release: Jul 17, 2017
  • Latest release: Aug 25, 2021
  • Number of updates: 62
  • Update frequency: every 35.2 days
  • Top authors: CardGate (100%)

Code review

54 tests

User reviews

4 reviews

Install metrics

500+ active / 8,617 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.02MB] [CPU: ▼136.13ms] 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 /2.85 ▲0.1441.03 ▲10.60
Dashboard /wp-admin3.08 ▲0.0347.33 ▲14.26
Posts /wp-admin/edit.php3.13 ▲0.0244.93 ▼1.77
Add New Post /wp-admin/post-new.php5.44 ▲0.0193.80 ▼550.22
Media Library /wp-admin/upload.php3.02 ▲0.0233.77 ▼3.13
Settings /wp-admin/admin.php?page=cardgate_menu2.9929.89
Payments Table /wp-admin/admin.php?page=cardgate_payments_table3.1632.57

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, 2 new options
New tables
wp_cardgate_payments
New WordPress options
cgp_version
cardgate_version

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 /3,764 ▲16815.81 ▲0.278.23 ▼0.0145.84 ▼11.64
Dashboard /wp-admin3,024 ▲935.90 ▼0.28132.82 ▼28.77126.99 ▲21.52
Posts /wp-admin/edit.php2,817 ▲812.68 ▼0.0261.25 ▼1.4194.23 ▲12.58
Add New Post /wp-admin/post-new.php1,711 ▼16118.87 ▼0.15364.78 ▲10.87107.83 ▼7.12
Media Library /wp-admin/upload.php1,812 ▼14.99 ▼0.02124.85 ▼24.06150.68 ▲31.06
Settings /wp-admin/admin.php?page=cardgate_menu1,3332.2155.4274.36
Payments Table /wp-admin/admin.php?page=cardgate_payments_table1,2872.0954.8764.42

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: 2 options
    • cardgate_version
    • cgp_version

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 'cardgate\\api\\resource\\Base' not found in wp-content/plugins/cardgate/cardgate-clientlib-php/src/resource/Methods.php:33
    • > PHP Fatal error
      Uncaught Error: Class 'cardgate\\api\\resource\\Base' not found in wp-content/plugins/cardgate/cardgate-clientlib-php/src/resource/Transactions.php:33
    • > PHP Fatal error
      Uncaught Error: Class 'CGP_Common_Gateway' not found in wp-content/plugins/cardgate/classes/WC_CardgateMistercash.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_CardgateIdealqr.php:11
    • > PHP Fatal error
      Uncaught Error: Class 'CGP_Common_Gateway' not found in wp-content/plugins/cardgate/classes/WC_CardgateCreditcard.php:11
    • > PHP Fatal error
      Uncaught Error: Class 'cardgate\\api\\Entity' not found in wp-content/plugins/cardgate/cardgate-clientlib-php/src/Address.php:85
    • > PHP Fatal error
      Uncaught Error: Class 'cardgate\\api\\Transaction' not found in wp-content/plugins/cardgate/cardgate-clientlib-php/src/Subscription.php:33
    • > PHP Fatal error
      Uncaught Error: Class 'CGP_Common_Gateway' not found in wp-content/plugins/cardgate/classes/WC_CardgatePrzelewy24.php:11
    • > PHP Fatal error
      Uncaught Error: Class 'cardgate\\api\\Entity' not found in wp-content/plugins/cardgate/cardgate-clientlib-php/src/Consumer.php:43

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

The principal PHP file in "CardGate Payments for WooCommerce" v. 3.1.21 is loaded by WordPress automatically on each request
You should first fix the following items:
  • Requires at least: Required version does not match the one declared in readme.txt ("4.2" instead of "4.4")

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,230 lines of code in 43 files:
LanguageFilesBlank linesComment linesLines of code
PHP416902,3143,091
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.70
▷ Minimum class complexity1.00
▷ Maximum class complexity113.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%
Methods206
▷ Static methods62.91%
▷ Public methods19594.66%
▷ Protected methods00.00%
▷ Private methods115.34%
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.png0.44KB0.62KB0.00%
images/cgp_icon-16x16_bw.png0.44KB0.62KB0.00%
images/cardgate.png22.06KB11.59KB▼ 47.44%
images/cgp_icon-16x16_color.png1.30KB0.63KB▼ 51.65%