100% wc-restrict-payment-methods

Code Review | WC Restrict Payment Methods

WordPress plugin WC Restrict Payment Methods scored 100% from 54 tests.

About plugin

  • Plugin page: wc-restrict-payme...
  • Plugin version: 1.1.2
  • PHP version: 7.4.16
  • WordPress compatibility: 3.9.13-5.7
  • WordPress version: 5.8.1
  • First release: May 1, 2017
  • Latest release: Apr 8, 2021
  • Number of updates: 43
  • Update frequency: every 33.4 days
  • Top authors: dimdavid (100%)

Code review

54 tests

User reviews

3 reviews

Install metrics

300+ active / 2,373 total downloads

Benchmarks

Plugin footprint Passed 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
The plugin installed gracefully, with no errors

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

An overview of server-side resources used by WC Restrict Payment Methods
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /2.85 ▲0.1334.26 ▲12.69
Dashboard /wp-admin3.08 ▲0.0253.27 ▲2.13
Posts /wp-admin/edit.php3.13 ▲0.0245.76 ▼2.34
Add New Post /wp-admin/post-new.php5.43 ▲0.0089.64 ▼573.83
Media Library /wp-admin/upload.php3.02 ▲0.0230.47 ▼6.60

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

Analyzing filesystem and database footprints of this plugin
The plugin installed successfully
Filesystem: 2 new files
Database: no new tables, no new options

Browser metrics Passed 4 tests

This is an overview of browser requirements for WC Restrict Payment Methods
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,689 ▲9315.99 ▲0.3011.55 ▼1.4550.71 ▲4.96
Dashboard /wp-admin2,980 ▲495.88 ▼0.27154.45 ▲0.62119.70 ▲10.17
Posts /wp-admin/edit.php2,749 ▲102.71 ▼0.0179.94 ▲9.8890.66 ▲2.77
Add New Post /wp-admin/post-new.php1,507 ▲718.45 ▼0.15382.79 ▼61.22112.74 ▲0.54
Media Library /wp-admin/upload.php1,817 ▲75.03 ▲0.03181.59 ▲33.60119.11 ▲12.47

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

🔸 Tests weight: 35 | All plugins must uninstall correctly, removing their source code and extra database tables they might have created
Uninstall script ran successfully

Smoke tests Passed 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)
The smoke test was a success, however most plugin functionality was not tested

SRP Passed 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
No output text or server-side errors detected on direct access of PHP files

User-side errors Passed 1 test

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

Optimizations

Plugin configuration Passed 29 tests

readme.txt Passed 16 tests

It's important to format your readme.txt file correctly as it is parsed for the public listing of your plugin
5 plugin tags: woocommerce, restrict, methods, gateway, payment

wc-restrict-payment-methods/wc-restrict-payment-methods.php Passed 13 tests

"WC Restrict Payment Methods" version 1.1.2's main PHP file describes plugin functionality and also serves as the entry point to any WordPress functionality
110 characters long description:
Restrict Woocommerce payment methods by products. If the product is in the cart, the method will not be shown.

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | An overview of files in this plugin; executable files are not allowed
Everything looks great! No dangerous files found in this plugin132 lines of code in 1 file:
LanguageFilesBlank linesComment linesLines of code
PHP12811132

PHP code Passed 2 tests

This plugin's cyclomatic complexity and code structure detailed below
This plugin has no cyclomatic complexity issues
Cyclomatic complexity
Average complexity per logical line of code0.50
Average class complexity19.00
▷ Minimum class complexity19.00
▷ Maximum class complexity19.00
Average method complexity2.38
▷ Minimum method complexity1.00
▷ Maximum method complexity8.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes1
▷ Abstract classes00.00%
▷ Concrete classes1100.00%
▷ Final classes00.00%
Methods13
▷ Static methods17.69%
▷ Public methods1292.31%
▷ Protected methods00.00%
▷ Private methods17.69%
Functions0
▷ Named functions00.00%
▷ Anonymous functions00.00%
Constants1
▷ Global constants00.00%
▷ Class constants1100.00%
▷ Public constants1100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

PNG files should be compressed to save space and minimize bandwidth usage
PNG images were not found in this plugin