66% business-to-customer-rest-apis-for-woocommerce

Code Review | Business to Customer Rest API for Woocommerce

WordPress plugin Business to Customer Rest API for Woocommercescored66%from 54 tests.

About plugin

  • Plugin page: business-to-custo...
  • Plugin version: 1.1.0
  • PHP compatiblity: 7.4+
  • PHP version: 7.4.16
  • WordPress compatibility: 6.1-5.6
  • WordPress version: 6.3.1
  • First release: Jan 22, 2021
  • Latest release: May 17, 2023
  • Number of updates: 35
  • Update frequency: every 24.4 days
  • Top authors: letscms (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /576 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Verifying that this plugin installs correctly without errors
Installer ran successfully

Server metrics [RAM: ▲0.07MB] [CPU: ▼11.07ms] Passed 4 tests

Server-side resources used by Business to Customer Rest API for Woocommerce
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /3.54 ▲0.0840.10 ▼1.11
Dashboard /wp-admin3.39 ▲0.0449.35 ▼16.42
Posts /wp-admin/edit.php3.50 ▲0.1451.28 ▼6.16
Add New Post /wp-admin/post-new.php5.97 ▲0.0896.02 ▼20.58
Media Library /wp-admin/upload.php3.31 ▲0.0837.79 ▲0.23

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

How much does this plugin use your filesystem and database?
The plugin installed successfully
Filesystem: 284 new files
Database: no new tables, 6 new options
New WordPress options
theysaidso_admin_options
widget_recent-comments
widget_theysaidso_widget
widget_recent-posts
db_upgraded
can_compress_scripts

Browser metrics Passed 4 tests

A check of browser resources used by Business to Customer Rest API for Woocommerce
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,801 ▲4014.67 ▲0.321.69 ▼0.0343.64 ▼3.27
Dashboard /wp-admin2,204 ▲305.56 ▼0.0282.98 ▼19.7142.21 ▼7.25
Posts /wp-admin/edit.php2,113 ▲132.13 ▲0.1441.12 ▼3.6338.09 ▼3.04
Add New Post /wp-admin/post-new.php1,541 ▲1323.36 ▲0.28613.00 ▼61.3070.06 ▲15.15
Media Library /wp-admin/upload.php1,412 ▲124.23 ▼0.15105.49 ▼13.2845.75 ▼2.48

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

🔸 Tests weight: 35 | All plugins must uninstall correctly, removing their source code and extra database tables they might have created
You still need to fix the following
  • This plugin did not uninstall successfully, leaving 6 options in the database
    • widget_recent-comments
    • theysaidso_admin_options
    • can_compress_scripts
    • widget_recent-posts
    • db_upgraded
    • widget_theysaidso_widget

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for server-side errors
Good news, no errors were detected

SRP 0% 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
The following issues need your attention
  • 2× PHP files output text when accessed directly:
    • > /wp-content/plugins/business-to-customer-rest-apis-for-woocommerce/vendor/stripe/stripe-php/build.php
    • > /wp-content/plugins/business-to-customer-rest-apis-for-woocommerce/vendor/stripe/stripe-php/update_certs.php
  • 186× GET requests to PHP files have triggered server-side errors or warnings (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'Stripe\\Service\\AbstractService' not found in wp-content/plugins/business-to-customer-rest-apis-for-woocommerce/vendor/stripe/stripe-php/lib/Service/OrderService.php:7
    • > PHP Fatal error
      Uncaught Error: Class 'Stripe\\Exception\\ApiErrorException' not found in wp-content/plugins/business-to-customer-rest-apis-for-woocommerce/vendor/stripe/stripe-php/lib/Exception/IdempotencyException.php:9
    • > PHP Fatal error
      Uncaught Error: Class 'Stripe\\ApiResource' not found in wp-content/plugins/business-to-customer-rest-apis-for-woocommerce/vendor/stripe/stripe-php/lib/CustomerBalanceTransaction.php:34
    • > PHP Fatal error
      Uncaught Error: Class 'Stripe\\Service\\AbstractServiceFactory' not found in wp-content/plugins/business-to-customer-rest-apis-for-woocommerce/vendor/stripe/stripe-php/lib/Service/Checkout/CheckoutServiceFactory.php:12
    • > PHP Fatal error
      Uncaught Error: Class 'Stripe\\Service\\AbstractService' not found in wp-content/plugins/business-to-customer-rest-apis-for-woocommerce/vendor/stripe/stripe-php/lib/Service/Issuing/CardService.php:7
    • > PHP Fatal error
      Uncaught Error: Class 'Stripe\\Service\\AbstractService' not found in wp-content/plugins/business-to-customer-rest-apis-for-woocommerce/vendor/stripe/stripe-php/lib/Service/CreditNoteService.php:7
    • > PHP Fatal error
      Uncaught Error: Class 'Stripe\\Service\\AbstractService' not found in wp-content/plugins/business-to-customer-rest-apis-for-woocommerce/vendor/stripe/stripe-php/lib/Service/SetupAttemptService.php:7
    • > PHP Fatal error
      Uncaught Error: Class 'Stripe\\Service\\AbstractService' not found in wp-content/plugins/business-to-customer-rest-apis-for-woocommerce/vendor/stripe/stripe-php/lib/Service/ChargeService.php:7
    • > PHP Fatal error
      Uncaught Error: Class 'Stripe\\ApiResource' not found in wp-content/plugins/business-to-customer-rest-apis-for-woocommerce/vendor/stripe/stripe-php/lib/Recipient.php:35
    • > PHP Fatal error
      Uncaught Error: Class 'Stripe\\ApiResource' not found in wp-content/plugins/business-to-customer-rest-apis-for-woocommerce/vendor/stripe/stripe-php/lib/Source.php:55

User-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no browser errors were triggered
No browser issues were found

Optimizations

Plugin configuration 73% from 29 tests

readme.txt 88% from 16 tests

It's important to format your readme.txt file correctly as it is parsed for the public listing of your plugin
Attributes that need to be fixed:
  • Plugin Name: Write the name of your plugin instead of "Plugin Name" on the first line ( === Business to Customer Rest API for Woocommerce=== )
  • Screenshots: Please add descriptions for these screenshots #1, #2, #3, #4, #5, #6 in business-to-customer-rest-apis-for-woocommerce/assets to your readme.txt
You can look at the official readme.txt

business-to-customer-rest-apis-for-woocommerce/lets-woo-api.php 54% from 13 tests

The main PHP script in "Business to Customer Rest API for Woocommerce" version 1.1.0 is automatically included on every request by WordPress
Please take the time to fix the following:
  • Requires at least: The required version number must match the one declared in readme.txt ("5.3" instead of "6.1")
  • Main file name: Name the main plugin file the same as the plugin slug ("business-to-customer-rest-apis-for-woocommerce.php" instead of "lets-woo-api.php")
  • Text Domain: Since WordPress version 4.6 the text domain is optional; if specified, it must be the same as the plugin slug
  • Requires PHP: The required version number must match the one declared in readme.txt ("7.0" instead of "7.4")
  • Domain Path: The domain path folder does not exist ("/i18n/languages/")
  • Description: Please keep the plugin description shorter than 140 characters (currently 147 characters long)

Code Analysis 5% from 3 tests

File types 0% from 1 test

🔸 Test weight: 35 | An overview of files in this plugin; executable files are not allowed
These items require your attention
  • You should never include executable (binary) or otherwise dangerous files in your plugin
    • .crt - Security Certificate in Firefox, IE, Chrome, Safari
      • wp-content/plugins/business-to-customer-rest-apis-for-woocommerce/vendor/stripe/stripe-php/data/ca-certificates.crt
19,938 lines of code in 266 files:
LanguageFilesBlank linesComment linesLines of code
PHP2532,3819,2479,417
CSS11,99289,037
Markdown476101,214
JSON410202
XML20038
make19027
YAML1003

PHP code Passed 2 tests

This is a very shot review of cyclomatic complexity and code structure
This plugin has no cyclomatic complexity issues
Cyclomatic complexity
Average complexity per logical line of code0.21
Average class complexity3.85
▷ Minimum class complexity1.00
▷ Maximum class complexity78.00
Average method complexity1.79
▷ Minimum method complexity1.00
▷ Maximum method complexity25.00
Code structure
Namespaces28
Interfaces6
Traits7
Classes227
▷ Abstract classes104.41%
▷ Concrete classes21795.59%
▷ Final classes00.00%
Methods819
▷ Static methods18522.59%
▷ Public methods75091.58%
▷ Protected methods293.54%
▷ Private methods404.88%
Functions12
▷ Named functions216.67%
▷ Anonymous functions1083.33%
Constants696
▷ Global constants81.15%
▷ Class constants68898.85%
▷ Public constants688100.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
There are no PNG files in this plugin