74% locked-payment-methods-for-woocommerce

Code Review | Locked Payment Methods for WooCommerce

WordPress plugin Locked Payment Methods for WooCommerce scored74%from 54 tests.

About plugin

  • Plugin page: locked-payment-me...
  • Plugin version: 1.3.5
  • PHP compatiblity: 7.4+
  • PHP version: 7.4.16
  • WordPress compatibility: 5.5-6.0.1
  • WordPress version: 6.3.1
  • First release: May 29, 2021
  • Latest release: Jul 13, 2022
  • Number of updates: 19
  • Update frequency: every 22.0 days
  • Top authors: deepwebsolutions (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /1,523 total downloads

Benchmarks

Plugin footprint 65% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Verifying that this plugin installs correctly without errors
The plugin installed gracefully, with no errors

Server metrics [RAM: ▲1.33MB] [CPU: ▲2.39ms] 75% from 4 tests

Analyzing server-side resources used by Locked Payment Methods for WooCommerce
The following require your attention
  • CPU: The total CPU usage must kept under 500.00ms (currently 1,848.67ms on /wp-admin/admin.php?page=locked-payment-methods-for-woocommerce)
PageMemory (MB)CPU Time (ms)
Home /4.79 ▲1.3357.23 ▲8.97
Dashboard /wp-admin4.64 ▲1.3451.40 ▲1.52
Posts /wp-admin/edit.php4.69 ▲1.3452.49 ▲5.28
Add New Post /wp-admin/post-new.php7.31 ▲1.4387.29 ▼4.82
Media Library /wp-admin/upload.php4.56 ▲1.3342.77 ▲7.59
Locked Payment Methods for WooCommerce /wp-admin/admin.php?page=locked-payment-methods-for-woocommerce4.921,848.67
Freemius Debug [v.2.4.4] /wp-admin/admin.php?page=freemius4.8839.09

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

Analyzing filesystem and database footprints of this plugin
No storage issues were detected
Filesystem: 697 new files
Database: no new tables, 11 new options
New WordPress options
fs_gdpr
can_compress_scripts
fs_active_plugins
theysaidso_admin_options
fs_accounts
widget_recent-posts
widget_theysaidso_widget
fs_debug_mode
db_upgraded
widget_recent-comments
...

Browser metrics Passed 4 tests

Locked Payment Methods for WooCommerce: an overview of browser usage
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,834 ▲8813.59 ▼0.711.61 ▼0.4428.07 ▼14.88
Dashboard /wp-admin2,229 ▲505.81 ▼0.09101.29 ▼5.6742.36 ▼2.06
Posts /wp-admin/edit.php2,121 ▲322.01 ▲0.0240.60 ▲0.3739.24 ▲4.07
Add New Post /wp-admin/post-new.php1,534 ▲123.32 ▼0.03666.30 ▲31.1558.99 ▼2.89
Media Library /wp-admin/upload.php1,417 ▲294.17 ▼0.02107.20 ▲4.6950.15 ▲7.95
Locked Payment Methods for WooCommerce /wp-admin/admin.php?page=locked-payment-methods-for-woocommerce9651.7429.0053.04
Freemius Debug [v.2.4.4] /wp-admin/admin.php?page=freemius1,0531.7125.5027.94

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
Please fix the following items
  • This plugin cannot be uninstalled
    • > Notice in wp-content/plugins/locked-payment-methods-for-woocommerce/vendor/freemius/wordpress-sdk/includes/class-freemius.php+8575
    Undefined property: stdClass::$plugins
  • The uninstall procedure has failed, leaving 11 options in the database
    • fs_active_plugins
    • can_compress_scripts
    • fs_debug_mode
    • fs_gdpr
    • theysaidso_admin_options
    • widget_theysaidso_widget
    • widget_recent-comments
    • widget_recent-posts
    • fs_accounts
    • locked_payment_methods_for_woocommerce_original_version
    • ...

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 | SRP (Single-Responsibility Principle) - PHP files must act as libraries and never output text or perform any action when accessed directly in a browser
The following issues need your attention
  • 58× PHP files trigger server-side errors or warnings when accessed directly (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Interface 'DWS_LPMWC_Deps\\Psr\\Container\\ContainerExceptionInterface' not found in wp-content/plugins/locked-payment-methods-for-woocommerce/dependencies/dependency-injection/php-di/php-di/src/Definition/Exception/InvalidDefinition.php:13
    • > PHP Fatal error
      Uncaught Error: Interface 'DWS_LPMWC_Deps\\DI\\Definition\\Definition' not found in wp-content/plugins/locked-payment-methods-for-woocommerce/dependencies/dependency-injection/php-di/php-di/src/Definition/ObjectDefinition/MethodInjection.php:12
    • > PHP Fatal error
      Uncaught Error: Class 'DWS_LPMWC_Deps\\Psr\\Log\\AbstractLogger' not found in wp-content/plugins/locked-payment-methods-for-woocommerce/dependencies/psr/log/Psr/Log/NullLogger.php:13
    • > PHP Fatal error
      Uncaught Error: Class 'DWS_LPMWC_Deps\\DI\\Definition\\Helper\\CreateDefinitionHelper' not found in wp-content/plugins/locked-payment-methods-for-woocommerce/dependencies/dependency-injection/php-di/php-di/src/Definition/Helper/AutowireDefinitionHelper.php:12
    • > PHP Fatal error
      Uncaught Error: Using $this when not in object context in wp-content/plugins/locked-payment-methods-for-woocommerce/dependencies/dependency-injection/php-di/php-di/src/Compiler/Template.php:4
    • > PHP Fatal error
      Uncaught Error: Interface 'DWS_LPMWC_Deps\\Invoker\\InvokerInterface' not found in wp-content/plugins/locked-payment-methods-for-woocommerce/dependencies/dependency-injection/php-di/invoker/src/Invoker.php:19
    • > PHP Fatal error
      Uncaught Error: Class 'DWS_LPMWC_Deps\\DI\\Definition\\FactoryDefinition' not found in wp-content/plugins/locked-payment-methods-for-woocommerce/dependencies/dependency-injection/php-di/php-di/src/Definition/DecoratorDefinition.php:12
    • > PHP Fatal error
      Uncaught Error: Interface 'DWS_LPMWC_Deps\\DI\\Factory\\RequestedEntry' not found in wp-content/plugins/locked-payment-methods-for-woocommerce/dependencies/dependency-injection/php-di/php-di/src/Definition/Definition.php:14
    • > PHP Fatal error
      Uncaught Error: Interface 'DWS_LPMWC_Deps\\Psr\\Container\\ContainerInterface' not found in wp-content/plugins/locked-payment-methods-for-woocommerce/dependencies/dependency-injection/php-di/php-di/src/Container.php:37
    • > PHP Fatal error
      Uncaught Error: Interface 'DWS_LPMWC_Deps\\DI\\Factory\\RequestedEntry' not found in wp-content/plugins/locked-payment-methods-for-woocommerce/dependencies/dependency-injection/php-di/php-di/src/Compiler/RequestedEntryHolder.php:10

User-side errors Passed 1 test

🔹 Test weight: 20 | This is just a short smoke test looking for browser issues
Everything seems fine, but this is not an exhaustive test

Optimizations

Plugin configuration Passed 29 tests

readme.txt Passed 16 tests

Perhaps the most important file in your plugin readme.txt gets parsed in order to generate the public listing of your plugin
3 plugin tags: woocommerce, manual permission, payment methods

locked-payment-methods-for-woocommerce/locked-payment-methods-for-woocommerce.php Passed 13 tests

The principal PHP file in "Locked Payment Methods for WooCommerce" v. 1.3.5 is loaded by WordPress automatically on each request
136 characters long description:
A WooCommerce extension which allows shop managers to hide payment methods from customers that haven't been manually granted access yet.

Code Analysis 97% from 3 tests

File types Passed 1 test

🔸 Test weight: 35 | This is an overview of file extensions present in this plugin and a short test that no dangerous files are bundled with this plugin
There were no executable files found in this plugin47,110 lines of code in 548 files:
LanguageFilesBlank linesComment linesLines of code
PHP5298,65833,57246,421
PO File2158238386
JavaScript33459194
JSON10048
SVG11030
Markdown14017
CSS110014

PHP code 50% from 2 tests

Analyzing logical lines of code, cyclomatic complexity, and other code metrics
The following items need your attention
  • Cyclomatic complexity of classes should be reduced to less than 1000 (currently 2,911)
Cyclomatic complexity
Average complexity per logical line of code0.59
Average class complexity15.44
▷ Minimum class complexity1.00
▷ Maximum class complexity2,911.00
Average method complexity3.54
▷ Minimum method complexity1.00
▷ Maximum method complexity86.00
Code structure
Namespaces100
Interfaces81
Traits98
Classes250
▷ Abstract classes3815.20%
▷ Concrete classes21284.80%
▷ Final classes209.43%
Methods2,578
▷ Static methods32612.65%
▷ Public methods2,02278.43%
▷ Protected methods1746.75%
▷ Private methods38214.82%
Functions233
▷ Named functions17374.25%
▷ Anonymous functions6025.75%
Constants220
▷ Global constants15972.27%
▷ Class constants6127.73%
▷ Public constants5996.72%

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
3 PNG files occupy 0.03MB with 0.02MB in potential savings
Potential savings
Compression of 3 random PNG files using pngquant
FileSize - originalSize - compressedSavings
vendor/freemius/wordpress-sdk/assets/img/plugin-icon.png9.16KB5.26KB▼ 42.58%
vendor/freemius/wordpress-sdk/assets/img/theme-icon.png10.97KB5.78KB▼ 47.37%
vendor/freemius/wordpress-sdk/assets/img/locked-payment-methods-for-woocommerce.png9.54KB3.07KB▼ 67.85%