78% cardinity-free-payment-gateway-for-woocommerce

Code Review | Cardinity Payment Gateway for WooCommerce

WordPress plugin Cardinity Payment Gateway for WooCommerce scored78%from 54 tests.

About plugin

  • Plugin page: cardinity-free-pa...
  • Plugin version: 3.2.1
  • PHP compatiblity: 7.2.5+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.0.2-6.5
  • WordPress version: 6.3.1
  • First release: Nov 2, 2016
  • Latest release: Nov 27, 2023
  • Number of updates: 84
  • Update frequency: every 30.7 days
  • Top authors: cardinity (100%)

Code review

54 tests

User reviews

10 reviews

Install metrics

500+ active /9,674 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
The plugin installed gracefully, with no errors

Server metrics [RAM: ▲0.27MB] [CPU: ▼5.54ms] Passed 4 tests

Server-side resources used by Cardinity Payment Gateway for WooCommerce
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /3.77 ▲0.3138.26 ▼4.08
Dashboard /wp-admin3.61 ▲0.2747.42 ▼11.69
Posts /wp-admin/edit.php3.66 ▲0.3148.61 ▲1.57
Add New Post /wp-admin/post-new.php6.13 ▲0.2489.19 ▼7.95
Media Library /wp-admin/upload.php3.47 ▲0.2435.11 ▲3.18

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

Filesystem and database footprint
This plugin installed successfully
Filesystem: 817 new files
Database: no new tables, 6 new options
New WordPress options
widget_recent-comments
db_upgraded
can_compress_scripts
widget_theysaidso_widget
theysaidso_admin_options
widget_recent-posts

Browser metrics Passed 4 tests

Checking browser requirements for Cardinity Payment Gateway for WooCommerce
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,790 ▲4314.12 ▼0.271.93 ▲0.1341.04 ▼5.86
Dashboard /wp-admin2,198 ▲205.61 ▼0.1298.24 ▼21.4841.55 ▼1.98
Posts /wp-admin/edit.php2,097 ▼32.01 ▼0.0140.48 ▲3.1336.14 ▲2.33
Add New Post /wp-admin/post-new.php1,526 ▼923.47 ▲0.69620.12 ▲38.4949.67 ▼0.13
Media Library /wp-admin/upload.php1,403 ▲34.21 ▲0.01101.04 ▲4.9244.53 ▲3.89

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

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
The following items require your attention
  • This plugin did not uninstall successfully, leaving 6 options in the database
    • db_upgraded
    • widget_theysaidso_widget
    • widget_recent-comments
    • theysaidso_admin_options
    • can_compress_scripts
    • widget_recent-posts

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the server (in the Apache logs)
Even though everything seems fine, this is not an exhaustive test

SRP 0% 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 items
  • 1× PHP files perform the task of outputting text when accessed with GET requests:
    • > /wp-content/plugins/cardinity-free-payment-gateway-for-woocommerce/redirect-to-external-checkout.php
  • 435× PHP files trigger errors when accessed directly with GET requests (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'Symfony\\Component\\Translation\\Dumper\\FileDumper' not found in wp-content/plugins/cardinity-free-payment-gateway-for-woocommerce/vendor/symfony/translation/Dumper/PhpFileDumper.php:21
    • > PHP Fatal error
      Uncaught Error: Interface 'Psr\\Http\\Message\\MessageInterface' not found in wp-content/plugins/cardinity-free-payment-gateway-for-woocommerce/vendor/psr/http-message/src/ResponseInterface.php:20
    • > PHP Fatal error
      Uncaught Error: Class 'Symfony\\Component\\Validator\\Constraint' not found in wp-content/plugins/cardinity-free-payment-gateway-for-woocommerce/vendor/symfony/validator/Constraints/Uuid.php:24
    • > PHP Fatal error
      Uncaught Error: Class 'GuzzleHttp\\Exception\\RequestException' not found in wp-content/plugins/cardinity-free-payment-gateway-for-woocommerce/vendor/guzzlehttp/guzzle/src/Exception/BadResponseException.php:10
    • > PHP Fatal error
      Uncaught Error: Class 'PhpSpec\\ObjectBehavior' not found in wp-content/plugins/cardinity-free-payment-gateway-for-woocommerce/vendor/cardinity/cardinity-sdk-php/spec/Method/VoidPayment/GetSpec.php:7
    • > PHP Fatal error
      Uncaught Error: Interface 'Symfony\\Component\\Validator\\Exception\\ExceptionInterface' not found in wp-content/plugins/cardinity-free-payment-gateway-for-woocommerce/vendor/symfony/validator/Exception/OutOfBoundsException.php:19
    • > PHP Notice
      Undefined index: amount in wp-content/plugins/cardinity-free-payment-gateway-for-woocommerce/redirect-to-external-checkout.php on line 12
    • > PHP Fatal error
      Uncaught Error: Class 'Symfony\\Component\\Validator\\Constraint' not found in wp-content/plugins/cardinity-free-payment-gateway-for-woocommerce/vendor/symfony/validator/Constraints/Isbn.php:25
    • > PHP Fatal error
      Uncaught Error: Class 'PHPUnit\\Framework\\TestCase' not found in wp-content/plugins/cardinity-free-payment-gateway-for-woocommerce/vendor/symfony/translation/Tests/IntervalTest.php:17
    • > PHP Fatal error
      Uncaught Error: Class 'Symfony\\Component\\Validator\\Constraints\\LessThanOrEqual' not found in wp-content/plugins/cardinity-free-payment-gateway-for-woocommerce/vendor/symfony/validator/Constraints/NegativeOrZero.php:21

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for browser errors
There were no browser issues found

Optimizations

Plugin configuration 96% from 29 tests

readme.txt Passed 16 tests

The readme.txt file describes your plugin functionality and requirements and it is parsed to prepare the your plugin's listing
6 plugin tags: payments, payment gateway, cardinity, woocommerce, cardinity checkout...

cardinity-free-payment-gateway-for-woocommerce/class-wc-gateway-cardinity.php 92% from 13 tests

The entry point to "Cardinity Payment Gateway for WooCommerce" version 3.2.1 is a PHP file that has certain tags in its header comment area
The following require your attention:
  • Main file name: Please rename the main PHP file in this plugin to the plugin slug ("cardinity-free-payment-gateway-for-woocommerce.php" instead of "class-wc-gateway-cardinity.php")

Code Analysis 97% from 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short review of files and their extensions; it is not recommended to include executable files
There were no executable files found in this plugin86,369 lines of code in 748 files:
LanguageFilesBlank linesComment linesLines of code
PHP5938,22617,16652,937
XML748321,585
XSD5117765,133
Markdown291,29704,419
JSON25002,087
YAML10320120
PO File67037
reStructuredText1326018
Dockerfile18010
Qt Linguist10010
make1409
Bourne Shell1203
INI1001

PHP code 50% from 2 tests

An short overview of logical lines of code, cyclomatic complexity, and other code metrics
It is recommended to fix the following
  • Cyclomatic complexity of methods has to be reduced to less than 100 (currently 179)
Cyclomatic complexity
Average complexity per logical line of code0.41
Average class complexity8.47
▷ Minimum class complexity1.00
▷ Maximum class complexity179.00
Average method complexity2.72
▷ Minimum method complexity1.00
▷ Maximum method complexity179.00
Code structure
Namespaces78
Interfaces57
Traits6
Classes486
▷ Abstract classes193.91%
▷ Concrete classes46796.09%
▷ Final classes326.85%
Methods2,511
▷ Static methods2509.96%
▷ Public methods2,08983.19%
▷ Protected methods1325.26%
▷ Private methods29011.55%
Functions315
▷ Named functions19461.59%
▷ Anonymous functions12138.41%
Constants430
▷ Global constants8820.47%
▷ Class constants34279.53%
▷ Public constants33297.08%

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.00MB with 0.00MB in potential savings
Potential savings
Compression of 1 random PNG file using pngquant
FileSize - originalSize - compressedSavings
images/cardinity.png3.68KB2.24KB▼ 38.99%