83% netdebit-payment-gateway

Code Review | netdebit-woocommerce-gateway

WordPress plugin netdebit-woocommerce-gateway scored83%from 54 tests.

About plugin

  • Plugin page: netdebit-payment-...
  • Plugin version: 0.1.0
  • PHP version: 7.4.16
  • WordPress compatibility: 4.6-5.7
  • WordPress version: 6.3.1
  • First release: Feb 7, 2017
  • Latest release: May 3, 2021
  • Number of updates: 28
  • Update frequency: every 55.2 days
  • Top authors: ipps (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /1,773 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | The install procedure must perform silently
This plugin's installer ran successfully

Server metrics [RAM: ▼0.00MB] [CPU: ▼2.76ms] Passed 4 tests

This is a short check of server-side resources used by netdebit-woocommerce-gateway
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /3.47 ▲0.0143.09 ▲6.58
Dashboard /wp-admin3.32 ▼0.0347.31 ▼16.24
Posts /wp-admin/edit.php3.37 ▲0.0150.68 ▲2.01
Add New Post /wp-admin/post-new.php5.90 ▲0.0195.99 ▲0.97
Media Library /wp-admin/upload.php3.24 ▲0.0134.95 ▲2.21

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

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

Browser metrics Passed 4 tests

Checking browser requirements for netdebit-woocommerce-gateway
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,790 ▲2814.72 ▲0.321.62 ▲0.1336.62 ▼4.12
Dashboard /wp-admin2,198 ▲285.64 ▼0.0191.61 ▼12.5243.21 ▲2.51
Posts /wp-admin/edit.php2,100 ▼31.94 ▼0.1838.93 ▼3.2635.23 ▼7.57
Add New Post /wp-admin/post-new.php1,526 ▼022.92 ▼0.20637.95 ▲50.8452.47 ▼1.64
Media Library /wp-admin/upload.php1,403 ▼04.16 ▼0.0294.26 ▼3.7239.65 ▼0.99

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

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
You still need to fix the following
  • This plugin did not uninstall successfully, leaving 6 options in the database
    • db_upgraded
    • widget_recent-comments
    • widget_theysaidso_widget
    • theysaidso_admin_options
    • widget_recent-posts
    • can_compress_scripts

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no server-side errors were triggered
Even though no errors were found, this is by no means an exhaustive test

SRP 50% from 2 tests

🔹 Tests weight: 20 | SRP (Single-Responsibility Principle) - PHP files must act as libraries and never output text or perform any action when accessed directly in a browser
Almost there! Just fix the following items
  • 18× PHP files trigger server errors when accessed directly (only 10 are shown):
    • > PHP Warning
      Use of undefined constant ABSPATH - assumed 'ABSPATH' (this will throw an Error in a future version of PHP) in wp-content/plugins/netdebit-payment-gateway/src/Table/SubscriptionsTable.php on line 5
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugin_dir_url() in wp-content/plugins/netdebit-payment-gateway/netdebit-woocommerce-gateway.php:24
    • > PHP Fatal error
      Uncaught Error: Interface 'NetDebit\\Plugin\\WooCommerce\\Initialisation\eedsInitialisation' not found in wp-content/plugins/netdebit-payment-gateway/src/WebHook/WC_NetDebit_Booking.php:19
    • > PHP Fatal error
      Uncaught Error: Interface 'NetDebit\\Plugin\\WooCommerce\\Initialisation\eedsInitialisation' not found in wp-content/plugins/netdebit-payment-gateway/src/WebHook/WC_NetDebit_ThankYou.php:15
    • > PHP Warning
      require_once(ABSPATHwp-admin/includes/upgrade.php): failed to open stream: No such file or directory in wp-content/plugins/netdebit-payment-gateway/src/Table/SubscriptionsTable.php on line 5
    • > PHP Fatal error
      require_once(): Failed opening required 'ABSPATHwp-admin/includes/upgrade.php' (include_path='.:/usr/share/php') in wp-content/plugins/netdebit-payment-gateway/src/Table/SubscriptionsTable.php on line 5
    • > PHP Warning
      require_once(ABSPATHwp-admin/includes/upgrade.php): failed to open stream: No such file or directory in wp-content/plugins/netdebit-payment-gateway/src/Table/SubscriptionPaymentsTable.php on line 5
    • > PHP Warning
      require_once(ABSPATHwp-admin/includes/upgrade.php): failed to open stream: No such file or directory in wp-content/plugins/netdebit-payment-gateway/src/Table/BookingTable.php on line 5
    • > PHP Fatal error
      Uncaught Error: Class 'WC_Payment_Gateway' not found in wp-content/plugins/netdebit-payment-gateway/includes/class_wc_netdebit_payment.php:2
    • > PHP Warning
      Use of undefined constant ABSPATH - assumed 'ABSPATH' (this will throw an Error in a future version of PHP) in wp-content/plugins/netdebit-payment-gateway/src/Table/SubscriptionPaymentsTable.php on line 5

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 90% from 29 tests

readme.txt 88% 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
Please fix the following attributes:
  • Tags: You are using too many tags: 19 tag instead of maximum 10
  • Donate link: Invalid url: "-"
The official readme.txt is a good inspiration

netdebit-payment-gateway/netdebit-woocommerce-gateway.php 92% from 13 tests

The primary PHP file in "netdebit-woocommerce-gateway" version 0.1.0 is used by WordPress to initiate all plugin functionality
Please make the necessary changes and fix the following:
  • Main file name: Please rename the main PHP file in this plugin to the plugin slug ("netdebit-payment-gateway.php" instead of "netdebit-woocommerce-gateway.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | This is an overview of programming languages used in this plugin; dangerous file extensions are not allowed
Success! There were no dangerous files found in this plugin1,378 lines of code in 20 files:
LanguageFilesBlank linesComment linesLines of code
PHP172971091,190
PO File26877184
JavaScript1004

PHP code Passed 2 tests

Cyclomatic complexity and code structure are the fingerprint of this plugin
This plugin has no cyclomatic complexity problems
Cyclomatic complexity
Average complexity per logical line of code0.23
Average class complexity7.71
▷ Minimum class complexity1.00
▷ Maximum class complexity25.00
Average method complexity2.22
▷ Minimum method complexity1.00
▷ Maximum method complexity11.00
Code structure
Namespaces6
Interfaces1
Traits0
Classes13
▷ Abstract classes00.00%
▷ Concrete classes13100.00%
▷ Final classes00.00%
Methods78
▷ Static methods2025.64%
▷ Public methods5773.08%
▷ Protected methods00.00%
▷ Private methods2126.92%
Functions7
▷ Named functions7100.00%
▷ Anonymous functions00.00%
Constants28
▷ Global constants621.43%
▷ Class constants2278.57%
▷ Public constants22100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Using a strong compression for your PNG files is a great way to speed-up your plugin
1 PNG file occupies 0.02MB with 0.02MB in potential savings
Potential savings
Compression of 1 random PNG file using pngquant
FileSize - originalSize - compressedSavings
assets/nd_logo.png19.84KB2.40KB▼ 87.93%