76% flexible-coupons

Code Review | Flexible PDF Coupons - Gift Cards & Vouchers for WooCommerce

WordPress plugin Flexible PDF Coupons - Gift Cards & Vouchers for WooCommerce scored76%from 54 tests.

About plugin

  • Plugin page: flexible-coupons
  • Plugin version: 1.9.0
  • PHP compatiblity: 7.3+
  • PHP version: 7.4.16
  • WordPress compatibility: 5.8-6.4
  • WordPress version: 6.3.1
  • First release: Jun 23, 2020
  • Latest release: Nov 16, 2023
  • Number of updates: 91
  • Update frequency: every 13.7 days
  • Top authors: wpdesk (100%)

Code review

54 tests

User reviews

19 reviews

Install metrics

1,000+ active /40,724 total downloads

Benchmarks

Plugin footprint 82% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | All plugins must install correctly, without throwing any errors, warnings, or notices
This plugin's installer ran successfully

Server metrics [RAM: ▲0.58MB] [CPU: ▼4.58ms] Passed 4 tests

Server-side resources used by Flexible PDF Coupons - Gift Cards & Vouchers for WooCommerce
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /4.05 ▲0.5943.32 ▼0.20
Dashboard /wp-admin3.89 ▲0.5849.03 ▼1.57
Posts /wp-admin/edit.php3.94 ▲0.5850.88 ▼5.97
Add New Post /wp-admin/post-new.php6.47 ▲0.5886.75 ▼10.57
Media Library /wp-admin/upload.php3.81 ▲0.5837.45 ▲2.25

Server storage [IO: ▲82.58MB] [DB: ▲0.00MB] 67% from 3 tests

Filesystem and database footprint
Please try to fix the following items
  • Total filesystem usage must be limited to 25MB (currently using 82.58MB)
Filesystem: 1,195 new files
Database: no new tables, 8 new options
New WordPress options
db_upgraded
widget_recent-posts
widget_recent-comments
widget_theysaidso_widget
plugin_activation_flexible-coupons/flexible-coupons.php
can_compress_scripts
wpdesk_requirements_plugins_data
theysaidso_admin_options

Browser metrics Passed 4 tests

Flexible PDF Coupons - Gift Cards & Vouchers for WooCommerce: an overview of browser usage
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,818 ▲5614.70 ▲0.451.94 ▲0.0843.95 ▼3.30
Dashboard /wp-admin2,198 ▲185.62 ▲0.0191.33 ▼8.5741.42 ▼4.99
Posts /wp-admin/edit.php2,103 ▲32.01 ▲0.0440.41 ▼0.5838.36 ▲0.49
Add New Post /wp-admin/post-new.php1,529 ▲323.16 ▼0.37664.69 ▼25.5665.31 ▲3.04
Media Library /wp-admin/upload.php1,400 ▼04.27 ▲0.06101.12 ▲0.4346.97 ▲4.62

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
Please fix the following items
  • This plugin did not uninstall successfully, leaving 7 options in the database
    • db_upgraded
    • plugin_activation_flexible-coupons/flexible-coupons.php
    • widget_theysaidso_widget
    • can_compress_scripts
    • widget_recent-comments
    • widget_recent-posts
    • theysaidso_admin_options

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A smoke test targeting 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
Please fix the following
  • 6× PHP files perform the task of outputting text when accessed with GET requests:
    • > /wp-content/plugins/flexible-coupons/vendor_prefixed/wpdesk/wp-coupons-core/src/Coupons/Settings/Views/menu.php
    • > /wp-content/plugins/flexible-coupons/vendor_prefixed/wpdesk/wp-wpdesk-marketing/src/Boxes/Views/row_open.php
    • > /wp-content/plugins/flexible-coupons/vendor_prefixed/wpdesk/wp-wpdesk-marketing/src/Boxes/Views/row_close.php
    • > /wp-content/plugins/flexible-coupons/vendor_prefixed/wpdesk/wp-coupons-core/src/Coupons/Settings/Views/footer.php
    • > /wp-content/plugins/flexible-coupons/vendor_prefixed/wpdesk/wp-forms/templates/form-end.php
    • > /wp-content/plugins/flexible-coupons/vendor_prefixed/wpdesk/wp-wpdesk-marketing/src/Boxes/Views/all.php
  • 648× GET requests to PHP files trigger server-side errors or Error 500 responses (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'FlexibleCouponsVendor\\Mpdf\\Tag\\BlockTag' not found in wp-content/plugins/flexible-coupons/vendor_prefixed/mpdf/mpdf/src/Tag/Main.php:5
    • > PHP Fatal error
      Uncaught Error: Class 'FlexibleCouponsVendor\\Monolog\\Handler\\Handler' not found in wp-content/plugins/flexible-coupons/vendor_prefixed/monolog/monolog/src/Monolog/Handler/GroupHandler.php:23
    • > PHP Notice
      Undefined index: is_premium in wp-content/plugins/flexible-coupons/vendor_prefixed/wpdesk/wp-coupons-core/src/Coupons/Views/dashboard/fields/coupon-code-prefix.php on line 19
    • > PHP Fatal error
      Uncaught Error: Call to a member function output_render() on null in wp-content/plugins/flexible-coupons/vendor_prefixed/wpdesk/wp-forms/templates/input-text.php:12
    • > PHP Fatal error
      Uncaught Error: Class 'FlexibleCouponsVendor\\Monolog\\Formatter\\JsonFormatter' not found in wp-content/plugins/flexible-coupons/vendor_prefixed/monolog/monolog/src/Monolog/Formatter/LogglyFormatter.php:19
    • > PHP Fatal error
      Uncaught Error: Interface 'FlexibleCouponsVendor\\WPDesk\\Persistence\\PersistentContainer' not found in wp-content/plugins/flexible-coupons/vendor_prefixed/wpdesk/wp-persistence/src/DeferredPersistentContainer.php:10
    • > PHP Fatal error
      Uncaught Error: Interface 'Psr\\Log\\LoggerInterface' not found in wp-content/plugins/flexible-coupons/vendor/psr/log/Psr/Log/AbstractLogger.php:12
    • > PHP Fatal error
      Uncaught Error: Class 'FlexibleCouponsVendor\\Mpdf\\Tag\\BlockTag' not found in wp-content/plugins/flexible-coupons/vendor_prefixed/mpdf/mpdf/src/Tag/BlockQuote.php:5
    • > PHP Fatal error
      Uncaught Error: Interface 'FlexibleCouponsVendor\\WPDesk\\PluginBuilder\\Plugin\\Hookable' not found in wp-content/plugins/flexible-coupons/src/Plugin/Settings/GeneralSettings.php:23
    • > PHP Fatal error
      Uncaught Error: Class 'FlexibleCouponsVendor\\Mpdf\\Tag\\SubstituteTag' not found in wp-content/plugins/flexible-coupons/vendor_prefixed/mpdf/mpdf/src/Tag/Ttz.php:5

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
There were no browser issues found

Optimizations

Plugin configuration 86% from 29 tests

readme.txt Passed 16 tests

The readme.txt file is important because it is parsed by WordPress.org for the public listing of your plugin
5 plugin tags: vouchers, gift cards, woocommerce coupon, woocommerce voucher, woocommerce gift cards

flexible-coupons/flexible-coupons.php 69% from 13 tests

The main PHP script in "Flexible PDF Coupons - Gift Cards & Vouchers for WooCommerce" version 1.9.0 is automatically included on every request by WordPress
Please take the time to fix the following:
  • Description: If Twitter did it, so should we! Keep the description under 140 characters (currently 183 characters long)
  • Git Repository: A Git repository was detected inside this plugin
  • Requires PHP: Required version does not match the one declared in readme.txt ("7.2" instead of "7.3")
  • Requires at least: Required version does not match the one declared in readme.txt ("5.0" instead of "5.8")

Code Analysis 95% from 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short check of programming languages and file extensions; no executable files are allowed
Success! There were no dangerous files found in this plugin134,952 lines of code in 963 files:
LanguageFilesBlank linesComment linesLines of code
PHP8732,65329,12990,313
JavaScript3510,37010,01541,362
JSON28001,754
CSS18233871,363
Markdown416068
XML313060
PO File13325
YAML1207

PHP code 0% from 2 tests

An short overview of logical lines of code, cyclomatic complexity, and other code metrics
Please tend to the following items
  • Class cyclomatic complexity should be reduced to less than 1000 (currently 7,009)
  • Cyclomatic complexity of methods has to be reduced to less than 100 (currently 460)
Cyclomatic complexity
Average complexity per logical line of code0.49
Average class complexity28.73
▷ Minimum class complexity1.00
▷ Maximum class complexity7,009.00
Average method complexity7.21
▷ Minimum method complexity1.00
▷ Maximum method complexity460.00
Code structure
Namespaces124
Interfaces74
Traits19
Classes615
▷ Abstract classes274.39%
▷ Concrete classes58895.61%
▷ Final classes376.29%
Methods3,364
▷ Static methods2798.29%
▷ Public methods2,68979.93%
▷ Protected methods2868.50%
▷ Private methods38911.56%
Functions124
▷ Named functions4032.26%
▷ Anonymous functions8467.74%
Constants630
▷ Global constants50.79%
▷ Class constants62599.21%
▷ Public constants59795.52%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

Using a strong compression for your PNG files is a great way to speed-up your plugin
55 PNG files occupy 5.93MB with 2.25MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/repository/screenshot-17.png7.10KB7.33KB0.00%
assets/repository/banner-772x250.png17.96KB7.20KB▼ 59.88%
assets/repository/screenshot-13.png126.28KB135.20KB0.00%
assets/repository/screenshot-51.png224.78KB66.97KB▼ 70.21%
assets/repository/screenshot-52.png74.78KB30.19KB▼ 59.63%