73% woo-mynix-braintree

Code Review | Woo Braintree Payment

WordPress plugin Woo Braintree Payment scored73%from 54 tests.

About plugin

  • Plugin page: woo-mynix-braintree
  • Plugin version: 0.2-1 $...
  • PHP version: 7.4.16
  • WordPress compatibility: 3.3-4.8
  • WordPress version: 6.3.1
  • First release: Oct 7, 2015
  • Latest release: Jan 17, 2017
  • Number of updates: 29
  • Update frequency: every 21.5 days
  • Top authors: eugenmihailescu (100%)

Code review

54 tests

User reviews

8 reviews

Install metrics

10+ active /4,178 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
Installer ran successfully

Server metrics [RAM: ▼0.01MB] [CPU: ▼8.35ms] Passed 4 tests

An overview of server-side resources used by Woo Braintree Payment
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /3.46 ▲0.0033.12 ▼7.00
Dashboard /wp-admin3.31 ▼0.0443.70 ▼17.12
Posts /wp-admin/edit.php3.36 ▲0.0047.31 ▼2.66
Add New Post /wp-admin/post-new.php5.89 ▲0.0091.83 ▼6.61
Media Library /wp-admin/upload.php3.23 ▲0.0030.90 ▼0.37

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

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

Browser metrics Passed 4 tests

Woo Braintree Payment: an overview of browser usage
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,790 ▲4314.68 ▲0.361.55 ▼0.2541.96 ▼3.07
Dashboard /wp-admin2,192 ▲125.48 ▼0.0490.83 ▼7.2540.74 ▼0.76
Posts /wp-admin/edit.php2,097 ▼32.01 ▲0.0139.58 ▲2.1835.05 ▲2.58
Add New Post /wp-admin/post-new.php1,526 ▼323.32 ▲0.11593.39 ▼118.6853.69 ▼3.05
Media Library /wp-admin/upload.php1,400 ▲34.21 ▼0.0497.99 ▼0.1142.21 ▲0.15

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
Please fix the following items
  • This plugin did not uninstall successfully, leaving 6 options in the database
    • db_upgraded
    • widget_recent-comments
    • widget_recent-posts
    • widget_theysaidso_widget
    • can_compress_scripts
    • theysaidso_admin_options

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a short smoke test looking for server-side errors
Even though everything seems fine, this is not an exhaustive test

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
The following issues need your attention
  • 163× GET requests to PHP files trigger server-side errors or Error 500 responses (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'Braintree\\Collection' not found in wp-content/plugins/woo-mynix-braintree/assets/vendor/Braintree/Error/ValidationErrorCollection.php:20
    • > PHP Fatal error
      Uncaught Error: Class 'Braintree\\Base' not found in wp-content/plugins/woo-mynix-braintree/assets/vendor/Braintree/PartnerMerchant.php:19
    • > PHP Fatal error
      Uncaught Error: Class 'Braintree\\Base' not found in wp-content/plugins/woo-mynix-braintree/assets/vendor/braintree/lib/Braintree/Transaction.php:174
    • > PHP Fatal error
      Uncaught Error: Class 'Braintree\\EqualityNode' not found in wp-content/plugins/woo-mynix-braintree/assets/vendor/Braintree/PartialMatchNode.php:4
    • > PHP Fatal error
      Uncaught Error: Class 'Braintree\\Instance' not found in wp-content/plugins/woo-mynix-braintree/assets/vendor/Braintree/MerchantAccount/AddressDetails.php:6
    • > PHP Fatal error
      Uncaught Error: Class 'Braintree\\Base' not found in wp-content/plugins/woo-mynix-braintree/assets/vendor/Braintree/MerchantAccount.php:4
    • > PHP Fatal error
      Uncaught Error: Class 'Braintree\\Base' not found in wp-content/plugins/woo-mynix-braintree/assets/vendor/Braintree/CreditCard.php:32
    • > PHP Fatal error
      Uncaught Error: Class 'Braintree\\MultipleValueNode' not found in wp-content/plugins/woo-mynix-braintree/assets/vendor/braintree/lib/Braintree/MultipleValueOrTextNode.php:4
    • > PHP Fatal error
      Uncaught Error: Class 'Braintree\\Base' not found in wp-content/plugins/woo-mynix-braintree/assets/vendor/Braintree/Subscription.php:16
    • > PHP Fatal error
      Uncaught Error: Class 'Braintree\\Instance' not found in wp-content/plugins/woo-mynix-braintree/assets/vendor/Braintree/Result/Successful.php:31

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)
Everything seems fine on the user side

Optimizations

Plugin configuration 83% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file is important because it is parsed by WordPress.org for the public listing of your plugin
These attributes need your attention:
  • Plugin Name: You should set the name of your plugin on the first line ( === woo-mynix-braintree === )
You can take inspiration from this readme.txt

woo-mynix-braintree/woo-mynix-braintree-gateway.php 69% from 13 tests

This is the main PHP file of "Woo Braintree Payment" version 0.2-1 $..., providing information about the plugin in the header fields and serving as the principal entry point to the plugin's functions
Please take the time to fix the following:
  • Main file name: Please rename the main PHP file in this plugin to the plugin slug ("woo-mynix-braintree.php" instead of "woo-mynix-braintree-gateway.php")
  • Description: A good plugin description is longer than 10 characters (currently 0 characters long)
  • Version: Use only periods and digits for the version number (ex. "1.0.3" instead of "0.2-1 $...")
  • Text Domain: Since WordPress version 4.6 the text domain is optional; if specified, it must be the same as the plugin slug

Code Analysis 5% from 3 tests

File types 0% from 1 test

🔸 Test weight: 35 | Executable files are considered dangerous and should not be included with any WordPress plugin
Please fix the following items
  • Do not distribute dangerous files with your plugin
    • .crt - Security Certificate in Firefox, IE, Chrome, Safari
      • wp-content/plugins/woo-mynix-braintree/assets/vendor/ssl/api_braintreegateway_com.ca.crt
      • wp-content/plugins/woo-mynix-braintree/assets/vendor/braintree/lib/ssl/api_braintreegateway_com.ca.crt
16,125 lines of code in 204 files:
LanguageFilesBlank linesComment linesLines of code
PHP1912,0505,96915,262
JavaScript8133412
CSS4266387
Ruby117064

PHP code Passed 2 tests

A short review of cyclomatic complexity and code structure
Everything seems fine, there were no complexity issues found
Cyclomatic complexity
Average complexity per logical line of code0.22
Average class complexity5.91
▷ Minimum class complexity1.00
▷ Maximum class complexity155.00
Average method complexity1.78
▷ Minimum method complexity1.00
▷ Maximum method complexity27.00
Code structure
Namespaces11
Interfaces0
Traits0
Classes278
▷ Abstract classes41.44%
▷ Concrete classes27498.56%
▷ Final classes186.57%
Methods1,728
▷ Static methods72341.84%
▷ Public methods1,41681.94%
▷ Protected methods1126.48%
▷ Private methods20011.57%
Functions20
▷ Named functions1680.00%
▷ Anonymous functions420.00%
Constants1,268
▷ Global constants201.58%
▷ Class constants1,24898.42%
▷ Public constants1,248100.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
4 PNG files occupy 0.03MB with 0.02MB in potential savings
Potential savings
Compression of 4 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/img/pro-icon.png5.80KB2.77KB▼ 52.18%
assets/img/cc-badge.png6.40KB2.88KB▼ 54.92%
assets/img/icon-128x128.png18.26KB6.13KB▼ 66.46%
assets/img/pci-badge.png4.19KB2.21KB▼ 47.40%