72% yaycurrency

Code Review | YayCurrency - WooCommerce Multi-Currency Switcher

WordPress plugin YayCurrency - WooCommerce Multi-Currency Switcher scored72%from 54 tests.

About plugin

  • Plugin page: yaycurrency
  • Plugin version: 2.4.2
  • PHP compatiblity: 5.4+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.7-6.3.1
  • WordPress version: 6.3.1
  • First release: May 25, 2021
  • Latest release: Nov 18, 2023
  • Number of updates: 66
  • Update frequency: every 13.7 days
  • Top authors: yaycommerce (100%)

Code review

54 tests

User reviews

61 reviews

Install metrics

3,000+ active /44,986 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
Install script ran successfully

Server metrics [RAM: ▲0.16MB] [CPU: ▲0.41ms] Passed 4 tests

Server-side resources used by YayCurrency - WooCommerce Multi-Currency Switcher
This plugin does not affect your website's performance
PageMemory (MB)CPU Time (ms)
Home /3.61 ▲0.1438.12 ▲0.43
Dashboard /wp-admin3.47 ▲0.1645.72 ▼0.57
Posts /wp-admin/edit.php3.58 ▲0.2248.66 ▲1.45
Add New Post /wp-admin/post-new.php6.07 ▲0.1888.85 ▲8.31
Media Library /wp-admin/upload.php3.39 ▲0.1634.05 ▲0.34
Help /wp-admin/admin.php?page=yaycommerce-help3.1824.70
Other plugins /wp-admin/admin.php?page=yaycommerce-other-plugins3.3631.40

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

Analyzing filesystem and database footprints of this plugin
The plugin installed successfully
Filesystem: 298 new files
Database: no new tables, 6 new options
New WordPress options
theysaidso_admin_options
can_compress_scripts
widget_recent-posts
widget_theysaidso_widget
db_upgraded
widget_recent-comments

Browser metrics Passed 4 tests

This is an overview of browser requirements for YayCurrency - WooCommerce Multi-Currency Switcher
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,867 ▲12014.26 ▼0.461.90 ▲0.1944.75 ▲5.39
Dashboard /wp-admin2,247 ▲705.56 ▼0.0983.86 ▼21.3237.63 ▼5.86
Posts /wp-admin/edit.php2,152 ▲522.00 ▲0.0436.84 ▼3.7937.78 ▲2.48
Add New Post /wp-admin/post-new.php1,556 ▲9623.29 ▲5.50594.80 ▼137.0961.46 ▲9.94
Media Library /wp-admin/upload.php1,452 ▲494.22 ▼0.0299.00 ▼1.6644.49 ▲3.16
Help /wp-admin/admin.php?page=yaycommerce-help280.410.094.24
Other plugins /wp-admin/admin.php?page=yaycommerce-other-plugins1,1242.2432.1331.49

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
    • widget_recent-posts
    • theysaidso_admin_options
    • widget_theysaidso_widget
    • widget_recent-comments
    • can_compress_scripts
    • db_upgraded

Smoke tests 25% from 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 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× GET requests to PHP files return non-empty strings:
    • > /wp-content/plugins/yaycurrency/includes/templates/switcher/list-currencies.php
  • 15× PHP files trigger errors when accessed directly with GET requests (only 10 are shown):
    • > PHP Fatal error
      Trait 'Yay_Currency\\Utils\\SingletonTrait' not found in wp-content/plugins/yaycurrency/includes/Helpers/SupportHelper.php on line 8
    • > PHP Fatal error
      Uncaught Error: Class 'Yay_Currency\\Helpers\\YayCurrencyHelper' not found in wp-content/plugins/yaycurrency/includes/templates/switcher/currency-selected.php:5
    • > PHP Notice
      Undefined variable: switcher_size in wp-content/plugins/yaycurrency/includes/templates/switcher/custom-select.php on line 7
    • > PHP Fatal error
      Trait 'Yay_Currency\\Utils\\SingletonTrait' not found in wp-content/plugins/yaycurrency/includes/Helpers/Helper.php on line 6
    • > PHP Notice
      Undefined variable: is_show_currency_name in wp-content/plugins/yaycurrency/includes/templates/switcher/custom-select.php on line 5
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_attr() in wp-content/plugins/yaycurrency/includes/templates/switcher/custom-select.php:9
    • > PHP Fatal error
      Trait 'Yay_Currency\\Utils\\SingletonTrait' not found in wp-content/plugins/yaycurrency/includes/Helpers/YayCurrencyHelper.php on line 5
    • > PHP Fatal error
      Trait 'Yay_Currency\\Utils\\SingletonTrait' not found in wp-content/plugins/yaycurrency/includes/Initialize.php on line 10
    • > PHP Fatal error
      Trait 'Yay_Currency\\Utils\\SingletonTrait' not found in wp-content/plugins/yaycurrency/includes/Engine/ActDeact.php on line 10
    • > PHP Warning
      Invalid argument supplied for foreach() in wp-content/plugins/yaycurrency/includes/templates/switcher/list-currencies.php on line 9

User-side errors 0% from 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the browser (console and network errors and warnings)
These are user-side errors you should fix
    • > GET request to /wp-admin/admin.php?page=yaycommerce-help
    • > Network (severe)
    wp-admin/admin.php?page=yaycommerce-help - Failed to load resource: the server responded with a status of 500 (Internal Server Error)

Optimizations

Plugin configuration 90% from 29 tests

readme.txt Passed 16 tests

Often overlooked, readme.txt is one of the most important files in your plugin
6 plugin tags: multicurrency, currency exchange, woocommerce currency switcher, multi currency, currency converter...

yaycurrency/yay-currency.php 77% from 13 tests

"YayCurrency - WooCommerce Multi-Currency Switcher" version 2.4.2's main PHP file describes plugin functionality and also serves as the entry point to any WordPress functionality
The following require your attention:
  • Main file name: Even though not officially enforced, the main plugin file should be the same as the plugin slug ("yaycurrency.php" instead of "yay-currency.php")
  • Text Domain: If you choose to specify the text domain, it must be the same as the plugin slug; optional since WordPress version 4.6
  • Requires at least: Required version must match the one declared in readme.txt ("3.0" instead of "4.7")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short review of files and their extensions; it is not recommended to include executable files
There were no executable files found in this plugin16,373 lines of code in 290 files:
LanguageFilesBlank linesComment linesLines of code
PHP1032,53538211,991
PO File58109901,962
CSS614381,038
JavaScript1213314873
SVG16333508
JSON1001

PHP code Passed 2 tests

This is a short overview of cyclomatic complexity and code structure for this plugin
This plugin has no cyclomatic complexity issues
Cyclomatic complexity
Average complexity per logical line of code0.47
Average class complexity24.04
▷ Minimum class complexity1.00
▷ Maximum class complexity268.00
Average method complexity3.88
▷ Minimum method complexity1.00
▷ Maximum method complexity46.00
Code structure
Namespaces9
Interfaces0
Traits1
Classes88
▷ Abstract classes00.00%
▷ Concrete classes88100.00%
▷ Final classes00.00%
Methods714
▷ Static methods12617.65%
▷ Public methods69997.90%
▷ Protected methods141.96%
▷ Private methods10.14%
Functions18
▷ Named functions316.67%
▷ Anonymous functions1583.33%
Constants7
▷ Global constants7100.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
There are no PNG files in this plugin