67% global-payments-woocommerce

Code Review | GlobalPayments WooCommerce

WordPress plugin GlobalPayments WooCommerce scored67%from 54 tests.

About plugin

  • Plugin page: global-payments-w...
  • Plugin version: 1.9.5
  • PHP compatiblity: 7.1+
  • PHP version: 7.4.16
  • WordPress compatibility: 5.4-6.3.1
  • WordPress version: 6.3.1
  • First release: Apr 14, 2021
  • Latest release: Nov 9, 2023
  • Number of updates: 88
  • Update frequency: every 10.7 days
  • Top authors: globalpayments (100%)

Code review

54 tests

User reviews

1 review

Install metrics

400+ active /11,442 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | The install procedure must perform silently
The plugin installed successfully, without throwing any errors or notices

Server metrics [RAM: ▲0.08MB] [CPU: ▼0.33ms] Passed 4 tests

Server-side resources used by GlobalPayments WooCommerce
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /3.55 ▲0.0934.61 ▼7.33
Dashboard /wp-admin3.38 ▲0.0848.25 ▲2.22
Posts /wp-admin/edit.php3.50 ▲0.1448.08 ▲1.01
Add New Post /wp-admin/post-new.php5.97 ▲0.0894.60 ▲7.67
Media Library /wp-admin/upload.php3.31 ▲0.0833.90 ▲2.80

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

Analyzing filesystem and database footprints of this plugin
This plugin installed successfully
Filesystem: 788 new files
Database: no new tables, 6 new options
New WordPress options
widget_recent-comments
db_upgraded
can_compress_scripts
widget_theysaidso_widget
widget_recent-posts
theysaidso_admin_options

Browser metrics Passed 4 tests

GlobalPayments WooCommerce: an overview of browser usage
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,790 ▲2814.72 ▲0.371.71 ▲0.0138.05 ▼6.58
Dashboard /wp-admin2,198 ▲185.62 ▼0.0394.95 ▲0.2041.77 ▲0.13
Posts /wp-admin/edit.php2,097 ▼32.03 ▲0.0139.71 ▲0.8533.95 ▲3.19
Add New Post /wp-admin/post-new.php1,526 ▼023.19 ▲0.03637.05 ▼14.2751.72 ▲0.69
Media Library /wp-admin/upload.php1,403 ▲34.23 ▲0.0496.04 ▼5.8044.20 ▲0.82

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
You still need to fix the following
  • The uninstall procedure has failed, leaving 6 options in the database
    • widget_recent-comments
    • can_compress_scripts
    • db_upgraded
    • widget_recent-posts
    • widget_theysaidso_widget
    • theysaidso_admin_options

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for server-side errors
The smoke test was a success, however most plugin functionality was not tested

SRP 0% from 2 tests

🔹 Tests weight: 20 | The single-responsibility principle: PHP files have to remain inert when accessed directly, throwing no errors and performing no actions
Please fix the following
  • 23× PHP files output text when accessed directly (only 10 are shown):
    • > /wp-content/plugins/global-payments-woocommerce/vendor/globalpayments/php-sdk/examples/portico/google-pay/charge.php
    • > /wp-content/plugins/global-payments-woocommerce/vendor/globalpayments/php-sdk/examples/gp-ecom/hpp/response-endpoint.php
    • > /wp-content/plugins/global-payments-woocommerce/vendor/globalpayments/php-sdk/examples/gp-ecom/3DS2-Challenge/with-GP-js-library/index.php
    • > /wp-content/plugins/global-payments-woocommerce/vendor/globalpayments/php-sdk/examples/portico/manual-tokenize/charge.php
    • > /wp-content/plugins/global-payments-woocommerce/vendor/globalpayments/php-sdk/examples/gp-api/end-to-end/authorization.php
    • > /wp-content/plugins/global-payments-woocommerce/vendor/globalpayments/php-sdk/examples/portico/gift/charge.php
    • > /wp-content/plugins/global-payments-woocommerce/vendor/globalpayments/php-sdk/examples/portico/iframe-recurring-signup/recurring.php
    • > /wp-content/plugins/global-payments-woocommerce/vendor/globalpayments/php-sdk/examples/portico/pay-invoice/charge.php
    • > /wp-content/plugins/global-payments-woocommerce/vendor/globalpayments/php-sdk/examples/portico/point-of-sale/e3-swipe/charge.php
    • > /wp-content/plugins/global-payments-woocommerce/vendor/globalpayments/php-sdk/examples/portico/echeck/process.php
  • 545× PHP files trigger errors when accessed directly with GET requests (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'GlobalPayments\\Api\\Entities\\Enum' not found in wp-content/plugins/global-payments-woocommerce/vendor/globalpayments/php-sdk/src/Entities/Enums/DepositSortProperty.php:9
    • > PHP Fatal error
      Uncaught Error: Class 'GlobalPayments\\WooCommercePaymentGatewayProvider\\Gateways\\Handlers\\AbstractHandler' not found in wp-content/plugins/global-payments-woocommerce/src/Gateways/Handlers/DelayedAuthorizationHandler.php:7
    • > PHP Fatal error
      Uncaught Error: Class 'PHPUnit\\Framework\\TestCase' not found in wp-content/plugins/global-payments-woocommerce/vendor/globalpayments/php-sdk/test/Integration/Gateways/GpEcomConnector/ApmTest.php:15
    • > PHP Fatal error
      Uncaught Error: Class 'PHPUnit\\Framework\\TestCase' not found in wp-content/plugins/global-payments-woocommerce/vendor/globalpayments/php-sdk/test/Integration/Gateways/TransITConnector/TransITTests.php:17
    • > PHP Fatal error
      Uncaught Error: Class 'PHPUnit\\Framework\\TestCase' not found in wp-content/plugins/global-payments-woocommerce/vendor/globalpayments/php-sdk/test/Integration/Gateways/TransITConnector/Certification/Ecommerce_3.php:29
    • > PHP Fatal error
      Uncaught Error: Class 'GlobalPayments\\Api\\PaymentMethods\\EBT' not found in wp-content/plugins/global-payments-woocommerce/vendor/globalpayments/php-sdk/src/PaymentMethods/EBTCardData.php:8
    • > PHP Fatal error
      Uncaught Error: Class 'Locale' not found in wp-content/plugins/global-payments-woocommerce/vendor/globalpayments/php-sdk/src/Utils/StringUtils.php:56
    • > PHP Fatal error
      Uncaught Error: Class 'PHPUnit\\Framework\\TestCase' not found in wp-content/plugins/global-payments-woocommerce/vendor/globalpayments/php-sdk/test/Integration/Gateways/TransactionApiConnector/TransactionApiCreditTest.php:24
    • > PHP Fatal error
      Uncaught Error: Class 'GlobalPayments\\Api\\Entities\\Enum' not found in wp-content/plugins/global-payments-woocommerce/vendor/globalpayments/php-sdk/src/Entities/Enums/ReasonCode.php:13
    • > PHP Notice
      Trying to access array offset on value of type null in wp-content/plugins/global-payments-woocommerce/vendor/globalpayments/php-sdk/examples/portico/pay-invoice/charge.php on line 26

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for browser errors
No browser errors were detected

Optimizations

Plugin configuration 90% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file is undoubtedly the most important file in your plugin, preparing it for public listing on WordPress.org
Attributes that need to be fixed:
  • Tags: You are using too many tags: 17 tag instead of maximum 10
You can look at the official readme.txt

global-payments-woocommerce/globalpayments-gateway-provider-for-woocommerce.php 85% from 13 tests

Analyzing the main PHP file in "GlobalPayments WooCommerce" version 1.9.5
The following require your attention:
  • Description: If Twitter did it, so should we! Keep the description under 140 characters (currently 168 characters long)
  • Main file name: Name the main plugin file the same as the plugin slug ("global-payments-woocommerce.php" instead of "globalpayments-gateway-provider-for-woocommerce.php")

Code Analysis 3% from 3 tests

File types 0% from 1 test

🔸 Test weight: 35 | There should be no dangerous file extensions present in any WordPress plugin
Please fix the following items
  • Even if your plugin relies on executable files (for example a companion app), never distribute executable files with your plugin
    • .crt - Security Certificate in Firefox, IE, Chrome, Safari
      • wp-content/plugins/global-payments-woocommerce/vendor/globalpayments/php-sdk/test/Integration/Gateways/ProPay/TestData/selfSignedCertificate.crt
92,087 lines of code in 756 files:
LanguageFilesBlank linesComment linesLines of code
PHP70117,27517,40883,393
JavaScript227211,4285,951
HTML1274131,600
Markdown52130685
JSON400221
CSS6170148
XML401047
YAML29142

PHP code 50% from 2 tests

This is a very shot review of cyclomatic complexity and code structure
Please tend to the following items
  • Method cyclomatic complexity has to be reduced to less than 100 (currently 159)
Cyclomatic complexity
Average complexity per logical line of code0.14
Average class complexity8.70
▷ Minimum class complexity1.00
▷ Maximum class complexity582.00
Average method complexity2.08
▷ Minimum method complexity1.00
▷ Maximum method complexity159.00
Code structure
Namespaces88
Interfaces42
Traits6
Classes614
▷ Abstract classes304.89%
▷ Concrete classes58495.11%
▷ Final classes71.20%
Methods4,845
▷ Static methods3397.00%
▷ Public methods4,41291.06%
▷ Protected methods1783.67%
▷ Private methods2555.26%
Functions66
▷ Named functions2233.33%
▷ Anonymous functions4466.67%
Constants1,540
▷ Global constants30.19%
▷ Class constants1,53799.81%
▷ Public constants1,537100.00%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
18 PNG files occupy 0.58MB with 0.44MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
vendor/globalpayments/php-sdk/examples/portico/end-to-end/assets/images/ss-savedcards-amex@2x.png46.21KB10.54KB▼ 77.19%
vendor/globalpayments/php-sdk/examples/portico/point-of-sale/e3-swipe/assets/oranges.png80.92KB21.72KB▼ 73.16%
vendor/globalpayments/php-sdk/examples/portico/end-to-end/assets/images/ss-shield@1x.png35.75KB11.04KB▼ 69.12%
vendor/globalpayments/php-sdk/examples/portico/end-to-end/assets/images/ss-saved-mastercard@2x.png29.93KB6.56KB▼ 78.09%
vendor/globalpayments/php-sdk/examples/portico/end-to-end/assets/images/ss-shield-ie.png30.72KB4.13KB▼ 86.56%