74% webmicro-braintree-woo-addon

Code Review | Braintree Payment Gateway For WooCommerce

WordPress plugin Braintree Payment Gateway For WooCommerce scored74%from 54 tests.

About plugin

  • Plugin page: webmicro-braintre...
  • Plugin version: 1.0.0
  • PHP version: 7.4.16
  • WordPress version: 6.3.1
  • First release: Mar 23, 2016
  • Latest release: Sep 24, 2016
  • Number of updates: 8
  • Update frequency: every 23.1 days
  • Top authors: nazrulhassanmca (100%)

Code review

54 tests

User reviews

2 reviews

Install metrics

40+ active /2,123 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | It is important to correctly install your plugin, without throwing errors or notices
The plugin installed gracefully, with no errors

Server metrics [RAM: ▲0.06MB] [CPU: ▼2.49ms] Passed 4 tests

A check of server-side resources used by Braintree Payment Gateway For WooCommerce
This plugin does not affect your website's performance
PageMemory (MB)CPU Time (ms)
Home /3.53 ▲0.0641.79 ▼3.40
Dashboard /wp-admin3.37 ▲0.0653.98 ▼4.22
Posts /wp-admin/edit.php3.42 ▲0.0654.79 ▲3.72
Add New Post /wp-admin/post-new.php5.95 ▲0.0690.64 ▼0.77
Media Library /wp-admin/upload.php3.29 ▲0.0636.84 ▼1.57

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

Input-output and database impact of this plugin
No storage issues were detected
Filesystem: 145 new files
Database: no new tables, 6 new options
New WordPress options
can_compress_scripts
widget_recent-comments
db_upgraded
theysaidso_admin_options
widget_recent-posts
widget_theysaidso_widget

Browser metrics Passed 4 tests

An overview of browser requirements for Braintree Payment Gateway For WooCommerce
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,789 ▲2814.42 ▲0.071.73 ▼0.0044.02 ▼2.72
Dashboard /wp-admin2,195 ▲245.62 ▼0.0489.18 ▼12.9636.77 ▼10.75
Posts /wp-admin/edit.php2,100 ▼01.99 ▼0.0139.60 ▲3.8234.17 ▼5.22
Add New Post /wp-admin/post-new.php1,526 ▼1023.35 ▲4.94654.15 ▼5.1447.30 ▼24.51
Media Library /wp-admin/upload.php1,403 ▲64.21 ▲0.0099.74 ▼20.9844.30 ▼3.10

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
  • Zombie WordPress options were found after uninstall: 6 options
    • widget_theysaidso_widget
    • widget_recent-comments
    • can_compress_scripts
    • widget_recent-posts
    • theysaidso_admin_options
    • 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 | The single-responsibility principle applies for WordPress plugins as well - please make sure your PHP files perform no actions when accessed directly
Please fix the following items
  • 75× PHP files trigger server-side errors or warnings when accessed directly (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'Braintree\\Exception' not found in wp-content/plugins/webmicro-braintree-woo-addon/lib/Braintree/Exception/NotFound.php:13
    • > PHP Fatal error
      Uncaught Error: Class 'Braintree\\Instance' not found in wp-content/plugins/webmicro-braintree-woo-addon/lib/Braintree/Dispute/TransactionDetails.php:23
    • > PHP Fatal error
      Uncaught Error: Class 'Braintree\\Base' not found in wp-content/plugins/webmicro-braintree-woo-addon/lib/Braintree/SettlementBatchSummary.php:4
    • > PHP Fatal error
      Uncaught Error: Class 'Braintree\\Base' not found in wp-content/plugins/webmicro-braintree-woo-addon/lib/Braintree/UnknownPaymentMethod.php:25
    • > PHP Fatal error
      Uncaught Error: Class 'Braintree\\Base' not found in wp-content/plugins/webmicro-braintree-woo-addon/lib/Braintree/EuropeBankAccount.php:25
    • > PHP Fatal error
      Uncaught Error: Class 'Braintree\\Instance' not found in wp-content/plugins/webmicro-braintree-woo-addon/lib/Braintree/Transaction/AmexExpressCheckoutCardDetails.php:33
    • > PHP Fatal error
      Uncaught Error: Class 'Braintree\\Instance' not found in wp-content/plugins/webmicro-braintree-woo-addon/lib/Braintree/MerchantAccount/AddressDetails.php:6
    • > PHP Fatal error
      Uncaught Error: Class 'Braintree\\EqualityNode' not found in wp-content/plugins/webmicro-braintree-woo-addon/lib/Braintree/PartialMatchNode.php:4
    • > PHP Fatal error
      Uncaught Error: Class 'Braintree\\Exception' not found in wp-content/plugins/webmicro-braintree-woo-addon/lib/Braintree/Exception/UpgradeRequired.php:13
    • > PHP Fatal error
      Uncaught Error: Class 'Braintree\\Base' not found in wp-content/plugins/webmicro-braintree-woo-addon/lib/Braintree/ApplePayCard.php:29

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 93% 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
These attributes need to be fixed:
  • Requires at least: Version format is invalid
  • Tested up to: Version format is invalid
The official readme.txt might help

webmicro-braintree-woo-addon/webmicro-braintree-woo-addon.php Passed 13 tests

The main PHP file in "Braintree Payment Gateway For WooCommerce" ver. 1.0.0 adds more information about the plugin and also serves as the entry point for this plugin
125 characters long description:
This plugin adds a payment option in WooCommerce for customers to pay with their Credit Cards Via Braintree a Paypal Company.

Code Analysis 5% from 3 tests

File types 0% from 1 test

🔸 Test weight: 35 | This is a short overview of programming languages used in this plugin, detecting executable files
Almost there! Just fix the following issues
  • Do not include executable or dangerous files in your plugin
    • .crt - Security Certificate in Firefox, IE, Chrome, Safari
      • wp-content/plugins/webmicro-braintree-woo-addon/lib/ssl/api_braintreegateway_com.ca.crt
7,913 lines of code in 134 files:
LanguageFilesBlank linesComment linesLines of code
PHP1341,3203,6187,913

PHP code Passed 2 tests

This is a short overview of cyclomatic complexity and code structure for this plugin
There were no cyclomatic complexity issued detected
Cyclomatic complexity
Average complexity per logical line of code0.17
Average class complexity4.68
▷ Minimum class complexity1.00
▷ Maximum class complexity47.00
Average method complexity1.62
▷ Minimum method complexity1.00
▷ Maximum method complexity26.00
Code structure
Namespaces10
Interfaces0
Traits0
Classes132
▷ Abstract classes21.52%
▷ Concrete classes13098.48%
▷ Final classes1813.85%
Methods789
▷ Static methods35344.74%
▷ Public methods66384.03%
▷ Protected methods364.56%
▷ Private methods9011.41%
Functions6
▷ Named functions583.33%
▷ Anonymous functions116.67%
Constants606
▷ Global constants10.17%
▷ Class constants60599.83%
▷ Public constants605100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

It is recommended to compress PNG files in your plugin to minimize bandwidth usage
9 compressed PNG files occupy 0.01MB
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
images/mastercard.png1.50KB1.46KB▼ 2.34%
images/visa.png1.25KB1.29KB0.00%
images/maestro.png1.61KB1.47KB▼ 8.80%
images/discover.png1.28KB1.30KB0.00%
images/amex.png2.19KB1.75KB▼ 20.33%