83% btcpay-for-woocommerce

Code Review | BTCPay for WooCommerce (Legacy)

WordPress plugin BTCPay for WooCommerce (Legacy) scored 83% from 54 tests.

About plugin

  • Plugin page: btcpay-for-woocom...
  • Plugin version: 3.0.16
  • PHP compatiblity: 5.6+
  • PHP version: 7.4.16
  • WordPress compatibility: 3.9-5.9
  • WordPress version: 5.9.2
  • First release: Nov 27, 2018
  • Latest release: Feb 23, 2022
  • Number of updates: 28
  • Update frequency: every 42.4 days
  • Top authors: nicolasdorier (50%)kukks (50%)esky33 (7.14%)

Code review

54 tests

User reviews

17 reviews

Install metrics

2,000+ active / 20,328 total downloads

Benchmarks

Plugin footprint Passed 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | All plugins must install correctly, without throwing any errors, warnings, or notices
The plugin installed successfully, without throwing any errors or notices

Server metrics [RAM: ▼0.02MB] [CPU: ▼297.16ms] Passed 4 tests

A check of server-side resources used by BTCPay for WooCommerce (Legacy)
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /3.53 ▲0.0156.48 ▲6.48
Dashboard /wp-admin3.41 ▲0.0032.22 ▼6.28
Posts /wp-admin/edit.php3.65 ▲0.0034.90 ▼4.61
Add New Post /wp-admin/post-new.php6.88 ▼0.0992.97 ▼1,178.07
Media Library /wp-admin/upload.php3.30 ▲0.0024.80 ▲0.31

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

Analyzing filesystem and database footprints of this plugin
No storage issues were detected
Filesystem: 96 new files
Database: no new tables, no new options

Browser metrics Passed 4 tests

This is an overview of browser requirements for BTCPay for WooCommerce (Legacy)
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,795 ▲5315.86 ▲0.146.03 ▼0.122.91 ▲0.86
Dashboard /wp-admin2,892 ▲376.16 ▼0.01115.99 ▼19.71148.22 ▼11.32
Posts /wp-admin/edit.php2,688 ▲33.24 ▼0.0062.06 ▼2.24140.03 ▼0.98
Add New Post /wp-admin/post-new.php1,711 ▲1620.65 ▼0.53411.31 ▼77.03158.37 ▲3.33
Media Library /wp-admin/upload.php1,692 ▲35.54 ▼0.04135.21 ▼26.09186.94 ▼0.52

Uninstaller [IO: ▲0.00MB] [DB: ▲0.00MB] Passed 4 tests

🔸 Tests weight: 35 | It is important to correctly uninstall your plugin, without leaving any traces
Uninstaller ran successfully

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
Good news, no errors were detected

SRP 50% 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
  • 38× GET requests to PHP files have triggered server-side errors or warnings (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Interface 'Bitpay\\Util\\CurveParameterInterface' not found in wp-content/plugins/btcpay-for-woocommerce/lib/Bitpay/Util/Secp256k1.php:18
    • > PHP Fatal error
      Uncaught Error: Interface 'Bitpay\\ApplicationInterface' not found in wp-content/plugins/btcpay-for-woocommerce/lib/Bitpay/Application.php:13
    • > PHP Fatal error
      Uncaught Error: Interface 'Bitpay\etwork\etworkInterface' not found in wp-content/plugins/btcpay-for-woocommerce/lib/Bitpay/Network/Customnet.php:13
    • > PHP Fatal error
      Uncaught Error: Interface 'Bitpay\\CurrencyInterface' not found in wp-content/plugins/btcpay-for-woocommerce/lib/Bitpay/Currency.php:17
    • > PHP Fatal error
      Uncaught Error: Class 'Bitpay\\Key' not found in wp-content/plugins/btcpay-for-woocommerce/lib/Bitpay/SinKey.php:16
    • > PHP Fatal error
      Uncaught Error: Interface 'Bitpay\\Storage\\StorageInterface' not found in wp-content/plugins/btcpay-for-woocommerce/lib/Bitpay/Storage/MockStorage.php:13
    • > PHP Fatal error
      Uncaught Error: Interface 'Bitpay\etwork\etworkInterface' not found in wp-content/plugins/btcpay-for-woocommerce/lib/Bitpay/Network/Livenet.php:13
    • > PHP Fatal error
      Uncaught Error: Interface 'Bitpay\\ItemInterface' not found in wp-content/plugins/btcpay-for-woocommerce/lib/Bitpay/Item.php:15
    • > PHP Fatal error
      Uncaught Error: Interface 'Bitpay\\Storage\\StorageInterface' not found in wp-content/plugins/btcpay-for-woocommerce/lib/Bitpay/Storage/FilesystemStorage.php:12
    • > PHP Fatal error
      Uncaught Error: Interface 'Bitpay\\Crypto\\CryptoInterface' not found in wp-content/plugins/btcpay-for-woocommerce/lib/Bitpay/Crypto/OpenSSLExtension.php:14

User-side errors Passed 1 test

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

Optimizations

Plugin configuration 86% from 29 tests

readme.txt 94% from 16 tests

It's important to format your readme.txt file correctly as it is parsed for the public listing of your plugin
These attributes need to be fixed:
  • Tags: You are using too many tags: 11 tag instead of maximum 10
The official readme.txt might help

btcpay-for-woocommerce/class-wc-gateway-btcpay.php 77% from 13 tests

This is the main PHP file of "BTCPay for WooCommerce (Legacy)" version 3.0.16, providing information about the plugin in the header fields and serving as the principal entry point to the plugin's functions
It is important to fix the following:
  • Main file name: The principal plugin file should be the same as the plugin slug ("btcpay-for-woocommerce.php" instead of "class-wc-gateway-btcpay.php")
  • Domain Path: Prefix the domain path with a forward slash character ("/languages")
  • Domain Path: The domain path follows the same naming rules as the domain name, using only dashes and lowercase characters ("languages")

Code Analysis 5% from 3 tests

File types 0% from 1 test

🔸 Test weight: 35 | There should be no dangerous file extensions present in any WordPress plugin
It is important to fix the following items
  • Do not include executable or dangerous files in your plugin
    • .crt - Security Certificate in Firefox, IE, Chrome, Safari
      • wp-content/plugins/btcpay-for-woocommerce/lib/Bitpay/Client/Adapter/ca-bundle.crt
5,850 lines of code in 82 files:
LanguageFilesBlank linesComment linesLines of code
PHP761,6383,9335,684
CSS30064
JavaScript1337458
XML15634
Smarty10010

PHP code Passed 2 tests

A brief analysis of cyclomatic complexity and code structure for this plugin
No cyclomatic complexity issues were detected for this plugin
Cyclomatic complexity
Average complexity per logical line of code0.28
Average class complexity8.22
▷ Minimum class complexity1.00
▷ Maximum class complexity140.00
Average method complexity2.09
▷ Minimum method complexity1.00
▷ Maximum method complexity44.00
Code structure
Namespaces11
Interfaces24
Traits0
Classes50
▷ Abstract classes24.00%
▷ Concrete classes4896.00%
▷ Final classes12.08%
Methods643
▷ Static methods365.60%
▷ Public methods62897.67%
▷ Protected methods111.71%
▷ Private methods40.62%
Functions24
▷ Named functions1562.50%
▷ Anonymous functions937.50%
Constants41
▷ Global constants24.88%
▷ Class constants3995.12%
▷ Public constants39100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
7 PNG files occupy 0.34MB with 0.18MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/img/logo.png1.36KB1.50KB0.00%
assets/screenshot-5.png90.37KB24.56KB▼ 72.83%
assets/screenshot-2.png86.72KB22.37KB▼ 74.20%
assets/img/icon.png2.11KB1.30KB▼ 38.43%
assets/screenshot-3.png76.09KB18.82KB▼ 75.26%