84% cardinity-gateway-for-easy-digital-downloads

Code Review | Cardinity Payment Gateway for Easy Digital Downloads

WordPress plugin Cardinity Payment Gateway for Easy Digital Downloads scored84%from 54 tests.

About plugin

  • Plugin page: cardinity-gateway...
  • Plugin version: 2.0.6
  • PHP version: 7.4.16
  • WordPress compatibility: 4.4-6.1.1
  • WordPress version: 6.3.1
  • First release: Mar 7, 2018
  • Latest release: Mar 16, 2023
  • Number of updates: 21
  • Update frequency: every 87.4 days
  • Top authors: cardinity (100%)

Code review

54 tests

User reviews

2 reviews

Install metrics

10+ active /1,407 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
This plugin's installer ran successfully

Server metrics [RAM: ▲0.42MB] [CPU: ▼1.93ms] Passed 4 tests

Analyzing server-side resources used by Cardinity Payment Gateway for Easy Digital Downloads
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /3.93 ▲0.4645.53 ▲2.30
Dashboard /wp-admin3.76 ▲0.4653.22 ▼0.22
Posts /wp-admin/edit.php3.81 ▲0.4652.91 ▲4.89
Add New Post /wp-admin/post-new.php6.28 ▲0.3989.68 ▼11.31
Media Library /wp-admin/upload.php3.62 ▲0.3937.38 ▲1.53

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

How much does this plugin use your filesystem and database?
There were no storage issued detected upon installing this plugin
Filesystem: 613 new files
Database: no new tables, 6 new options
New WordPress options
can_compress_scripts
widget_recent-posts
widget_theysaidso_widget
theysaidso_admin_options
db_upgraded
widget_recent-comments

Browser metrics Passed 4 tests

A check of browser resources used by Cardinity Payment Gateway for Easy Digital Downloads
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,789 ▲314.34 ▼0.271.72 ▼0.7845.91 ▼2.95
Dashboard /wp-admin2,195 ▲155.56 ▼0.1286.26 ▼12.8239.52 ▼3.76
Posts /wp-admin/edit.php2,103 ▼01.97 ▼0.0542.22 ▲5.7936.27 ▲3.06
Add New Post /wp-admin/post-new.php1,535 ▲924.56 ▲1.33641.34 ▼58.8976.82 ▲22.68
Media Library /wp-admin/upload.php1,400 ▲34.25 ▲0.06101.45 ▼20.1741.83 ▼5.87

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

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
Please fix the following items
  • This plugin does not fully uninstall, leaving 6 options in the database
    • can_compress_scripts
    • theysaidso_admin_options
    • widget_recent-comments
    • widget_theysaidso_widget
    • widget_recent-posts
    • db_upgraded

Smoke tests 75% 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)
Everything seems fine, however 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
  • 336× GET requests to PHP files trigger server-side errors or Error 500 responses (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'PhpSpec\\ObjectBehavior' not found in wp-content/plugins/cardinity-gateway-for-easy-digital-downloads/vendor/cardinity/cardinity-sdk-php/spec/ClientSpec.php:13
    • > PHP Fatal error
      Uncaught Error: Class 'Symfony\\Component\\Validator\\Constraints\\AbstractComparisonValidator' not found in wp-content/plugins/cardinity-gateway-for-easy-digital-downloads/vendor/symfony/validator/Constraints/NotEqualToValidator.php:20
    • > PHP Fatal error
      Uncaught Error: Class 'Symfony\\Component\\Validator\\Constraint' not found in wp-content/plugins/cardinity-gateway-for-easy-digital-downloads/vendor/symfony/validator/Constraints/CardScheme.php:26
    • > PHP Fatal error
      Uncaught Error: Class 'Symfony\\Component\\Validator\\ConstraintValidator' not found in wp-content/plugins/cardinity-gateway-for-easy-digital-downloads/vendor/symfony/validator/Constraints/ChoiceValidator.php:27
    • > PHP Fatal error
      Uncaught Error: Interface 'Psr\\Http\\Message\\StreamInterface' not found in wp-content/plugins/cardinity-gateway-for-easy-digital-downloads/vendor/guzzlehttp/psr7/src/AppendStream.php:14
    • > PHP Fatal error
      Uncaught Error: Interface 'Cardinity\\Method\\MethodInterface' not found in wp-content/plugins/cardinity-gateway-for-easy-digital-downloads/vendor/cardinity/cardinity-sdk-php/src/Method/VoidPayment/Create.php:8
    • > PHP Fatal error
      Uncaught Error: Class 'Symfony\\Component\\Validator\\Constraint' not found in wp-content/plugins/cardinity-gateway-for-easy-digital-downloads/vendor/symfony/validator/Constraints/NotNull.php:23
    • > PHP Fatal error
      Uncaught Error: Interface 'Cardinity\\Method\\MethodInterface' not found in wp-content/plugins/cardinity-gateway-for-easy-digital-downloads/vendor/cardinity/cardinity-sdk-php/src/Method/Settlement/Get.php:8
    • > PHP Fatal error
      Uncaught Error: Class 'Symfony\\Component\\Validator\\Constraints\\Existence' not found in wp-content/plugins/cardinity-gateway-for-easy-digital-downloads/vendor/symfony/validator/Constraints/Required.php:20
    • > PHP Fatal error
      Uncaught Error: Interface 'Psr\\Http\\Message\\StreamInterface' not found in wp-content/plugins/cardinity-gateway-for-easy-digital-downloads/vendor/guzzlehttp/psr7/src/DroppingStream.php:13

User-side errors Passed 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the browser (console and network errors and warnings)
No browser issues were found

Optimizations

Plugin configuration 97% from 29 tests

readme.txt 94% from 16 tests

You should put a lot of thought into formatting readme.txt as it is used by WordPress.org to prepare the public listing of your plugin
These attributes need your attention:
  • Requires php: The plugin version is formatted incorrectly
The official readme.txt might help

cardinity-gateway-for-easy-digital-downloads/cardinity-gateway-for-easy-digital-downloads.php Passed 13 tests

The principal PHP file in "Cardinity Payment Gateway for Easy Digital Downloads" v. 2.0.6 is loaded by WordPress automatically on each request
44 characters long description:
Cardinity Gateway for Easy Digital Downloads

Code Analysis 97% from 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short glimpse at programming languages used with this plugin and a check that no dangerous files are present
Success! There were no dangerous files found in this plugin60,105 lines of code in 577 files:
LanguageFilesBlank linesComment linesLines of code
PHP4696,49114,24030,786
XML564222,252
Markdown271,48504,697
JSON19002,150
XSD1180142
YAML310053
reStructuredText1326018
INI1007

PHP code 50% from 2 tests

A short review of cyclomatic complexity and code structure
Please fix the following
  • Cyclomatic complexity of methods has to be reduced to less than 100 (currently 140)
Cyclomatic complexity
Average complexity per logical line of code0.43
Average class complexity7.98
▷ Minimum class complexity1.00
▷ Maximum class complexity166.00
Average method complexity2.53
▷ Minimum method complexity1.00
▷ Maximum method complexity140.00
Code structure
Namespaces53
Interfaces54
Traits7
Classes386
▷ Abstract classes133.37%
▷ Concrete classes37396.63%
▷ Final classes4612.33%
Methods2,092
▷ Static methods22310.66%
▷ Public methods1,80186.09%
▷ Protected methods844.02%
▷ Private methods2079.89%
Functions276
▷ Named functions16359.06%
▷ Anonymous functions11340.94%
Constants317
▷ Global constants92.84%
▷ Class constants30897.16%
▷ Public constants27388.64%

Plugin size Passed 2 tests

Image compression Passed 2 tests

All PNG images should be compressed to minimize bandwidth usage for end users
1 PNG file occupies 0.03MB with 0.02MB in potential savings
Potential savings
Compression of 1 random PNG file using pngquant
FileSize - originalSize - compressedSavings
assets/screenshot-1.png34.66KB17.00KB▼ 50.94%