78% conditional-payment-methods-for-woocommerce

Code Review | Conditional Payment Methods for WooCommerce

WordPress plugin Conditional Payment Methods for WooCommerce scored 78% from 54 tests.

About plugin

  • Plugin page: conditional-payme...
  • Plugin version: 1.0
  • PHP version: 7.4.16
  • WordPress compatibility: 4.7-4.7.3
  • WordPress version: 5.9.2
  • First release: May 18, 2017
  • Latest release: May 18, 2017
  • Number of updates: 5
  • Update frequency: N/A
  • Top authors: nimeshrmr (100%)

Code review

54 tests

User reviews

1 review

Install metrics

200+ active / 2,581 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.00MB] [CPU: ▼293.20ms] Passed 4 tests

Analyzing server-side resources used by Conditional Payment Methods for WooCommerce
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /3.54 ▲0.0370.63 ▲15.87
Dashboard /wp-admin3.43 ▲0.0337.52 ▼31.31
Posts /wp-admin/edit.php3.66 ▲0.0347.94 ▲7.13
Add New Post /wp-admin/post-new.php6.90 ▼0.07105.83 ▼1,145.38
Media Library /wp-admin/upload.php3.32 ▲0.0224.09 ▼3.23

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

Analyzing filesystem and database footprints of this plugin
The plugin installed successfully
Filesystem: 18 new files
Database: 1 new table, no new options
New tables
wp_wsmea_conditional_payment_methods

Browser metrics Passed 4 tests

An overview of browser requirements for Conditional Payment Methods for WooCommerce
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,795 ▲4115.97 ▲0.305.78 ▼0.052.35 ▼1.40
Dashboard /wp-admin2,888 ▲306.13 ▼0.05127.46 ▼10.61157.68 ▼0.51
Posts /wp-admin/edit.php2,700 ▲133.24 ▲0.0062.15 ▼6.39140.29 ▼42.84
Add New Post /wp-admin/post-new.php1,670 ▲1516.41 ▼4.24429.46 ▲28.90186.40 ▲30.38
Media Library /wp-admin/upload.php1,712 ▲145.50 ▼0.03138.55 ▼5.42190.54 ▲3.94

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

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
It is recommended to fix the following
  • The plugin did not uninstall successfully, leaving 1 table in the database
    • wp_wsmea_conditional_payment_methods

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for server-side errors
Everything seems fine, however this is by no means an exhaustive test

SRP 0% 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
Please fix the following
  • 1× PHP files perform the task of outputting text when accessed with GET requests:
    • > /wp-content/plugins/conditional-payment-methods-for-woocommerce/templates/menu-page-container.php
  • 8× PHP files trigger server errors when accessed directly:
    • > PHP Warning
      extract() expects parameter 1 to be array, null given in wp-content/plugins/conditional-payment-methods-for-woocommerce/templates/conditional-payment-method-settings.php on line 3
    • > PHP Fatal error
      require_once(): Failed opening required 'ABSPATHwp-admin/includes/class-wp-list-table.php' (include_path='.:/usr/share/php') in wp-content/plugins/conditional-payment-methods-for-woocommerce/classes/class-wcpma-conditional-payment-method-list-table.php on line 27
    • > PHP Warning
      extract() expects parameter 1 to be array, null given in wp-content/plugins/conditional-payment-methods-for-woocommerce/templates/menu-page-container.php on line 3
    • > PHP Warning
      Use of undefined constant ABSPATH - assumed 'ABSPATH' (this will throw an Error in a future version of PHP) in wp-content/plugins/conditional-payment-methods-for-woocommerce/classes/class-wcpma-conditional-payment-method-list-table.php on line 27
    • > PHP Fatal error
      Uncaught Error: Call to undefined function WC() in wp-content/plugins/conditional-payment-methods-for-woocommerce/templates/conditional-payment-method-settings.php:5
    • > PHP Warning
      require_once(ABSPATHwp-admin/includes/class-wp-list-table.php): failed to open stream: No such file or directory in wp-content/plugins/conditional-payment-methods-for-woocommerce/classes/class-wcpma-conditional-payment-method-list-table.php on line 27
    • > PHP Notice
      Undefined variable: tab_content in wp-content/plugins/conditional-payment-methods-for-woocommerce/templates/menu-page-container.php on line 8
    • > PHP Notice
      Undefined variable: tabs in wp-content/plugins/conditional-payment-methods-for-woocommerce/templates/menu-page-container.php on line 7

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
Everything seems fine, but this is not an exhaustive test

Optimizations

Plugin configuration 96% from 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
5 plugin tags: conditional payment methods, user country based payment method, woocommerce payment methods by user type, woocommerce, woocommerce checkout

conditional-payment-methods-for-woocommerce/woocommerce-conditional-payment-methods.php 92% from 13 tests

The principal PHP file in "Conditional Payment Methods for WooCommerce" v. 1.0 is loaded by WordPress automatically on each request
Please take the time to fix the following:
  • Main file name: Name the main plugin file the same as the plugin slug ("conditional-payment-methods-for-woocommerce.php" instead of "woocommerce-conditional-payment-methods.php")

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
No dangerous file extensions were detected825 lines of code in 15 files:
LanguageFilesBlank linesComment linesLines of code
PHP930154775
JavaScript312028
CSS35022

PHP code Passed 2 tests

This is a very shot review of cyclomatic complexity and code structure
No cyclomatic complexity issues were detected for this plugin
Cyclomatic complexity
Average complexity per logical line of code0.34
Average class complexity14.50
▷ Minimum class complexity5.00
▷ Maximum class complexity43.00
Average method complexity3.02
▷ Minimum method complexity1.00
▷ Maximum method complexity22.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes6
▷ Abstract classes00.00%
▷ Concrete classes6100.00%
▷ Final classes00.00%
Methods41
▷ Static methods12.44%
▷ Public methods4097.56%
▷ Protected methods00.00%
▷ Private methods12.44%
Functions6
▷ Named functions6100.00%
▷ Anonymous functions00.00%
Constants3
▷ Global constants3100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

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