84% voucherify

Code Review | Voucherify

WordPress plugin Voucherify scored84%from 54 tests.

About plugin

  • Plugin page: voucherify
  • Plugin version: 3.0.0
  • PHP compatiblity: 5.6+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.8-5.9.3
  • WordPress version: 6.3.1
  • First release: Jan 28, 2018
  • Latest release: Apr 20, 2022
  • Number of updates: 55
  • Update frequency: every 28.1 days
  • Top authors: rspective (100%)

Code review

54 tests

User reviews

1 review

Install metrics

20+ active /3,126 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
Installer ran successfully

Server metrics [RAM: ▲0.07MB] [CPU: ▼5.84ms] Passed 4 tests

A check of server-side resources used by Voucherify
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /3.55 ▲0.0841.22 ▼0.73
Dashboard /wp-admin3.39 ▲0.0449.66 ▼8.34
Posts /wp-admin/edit.php3.50 ▲0.1546.74 ▲1.50
Add New Post /wp-admin/post-new.php5.97 ▲0.0884.57 ▼15.78
Media Library /wp-admin/upload.php3.31 ▲0.0836.94 ▲1.67

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

Input-output and database impact of this plugin
No storage issues were detected
Filesystem: 138 new files
Database: no new tables, 6 new options
New WordPress options
widget_recent-comments
db_upgraded
theysaidso_admin_options
widget_recent-posts
widget_theysaidso_widget
can_compress_scripts

Browser metrics Passed 4 tests

An overview of browser requirements for Voucherify
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,800 ▲3914.33 ▼0.041.73 ▲0.0543.51 ▲7.73
Dashboard /wp-admin2,203 ▲285.57 ▼0.1484.17 ▼13.9737.13 ▼4.96
Posts /wp-admin/edit.php2,112 ▲302.02 ▲0.0037.68 ▲2.5734.51 ▼1.39
Add New Post /wp-admin/post-new.php1,537 ▲1123.27 ▼0.05654.71 ▲1.6152.64 ▼0.31
Media Library /wp-admin/upload.php1,405 ▲54.20 ▲0.0595.87 ▼0.5140.50 ▼2.74

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

🔸 Tests weight: 35 | It is important to correctly uninstall your plugin, without leaving any traces
The following items require your attention
  • Zombie WordPress options detected upon uninstall: 6 options
    • widget_recent-comments
    • theysaidso_admin_options
    • widget_recent-posts
    • can_compress_scripts
    • db_upgraded
    • widget_theysaidso_widget

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no server-side errors were triggered
The smoke test was a success, however most plugin functionality was not tested

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
Please fix the following
  • 49× GET requests to PHP files trigger server-side errors or Error 500 responses (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'PHPUnit_Framework_TestCase' not found in wp-content/plugins/voucherify/vendor/rspective/voucherify/test/PromotionsTest.php:8
    • > PHP Fatal error
      Uncaught Error: Class 'Voucherify\\Wordpress\\Common\\Services\\SessionService' not found in wp-content/plugins/voucherify/src/Voucherify/Wordpress/Handlers/GiftCards/GiftCardsSessionService.php:7
    • > PHP Fatal error
      Uncaught Error: Class 'Voucherify\\Wordpress\\Common\\Services\\CartService' not found in wp-content/plugins/voucherify/src/Voucherify/Wordpress/Handlers/GiftCards/GiftCardCartService.php:10
    • > PHP Fatal error
      Uncaught Error: Class 'PHPUnit_Framework_TestCase' not found in wp-content/plugins/voucherify/vendor/rspective/voucherify/test/ClientTest.php:8
    • > PHP Fatal error
      Uncaught Error: Class 'PHPUnit_Framework_TestCase' not found in wp-content/plugins/voucherify/vendor/rspective/voucherify/test/VouchersTest.php:8
    • > PHP Fatal error
      Uncaught Error: Class 'Voucherify\\Wordpress\\Common\\Models\\Voucher' not found in wp-content/plugins/voucherify/src/Voucherify/Wordpress/Handlers/Promotions/PromotionVoucher.php:7
    • > PHP Notice
      Undefined variable: code in wp-content/plugins/voucherify/partials/cart-discount-voucher.php on line 4
    • > PHP Fatal error
      Uncaught Error: Class 'Voucherify\\Wordpress\\Common\\Services\\ValidationService' not found in wp-content/plugins/voucherify/src/Voucherify/Wordpress/Handlers/DiscountVouchers/DiscountVoucherValidationService.php:28
    • > PHP Fatal error
      Uncaught Error: Class 'PHPUnit_Framework_TestCase' not found in wp-content/plugins/voucherify/vendor/rspective/voucherify/test/ValidationRulesTest.php:8
    • > PHP Fatal error
      Uncaught Error: Class 'Voucherify\\Wordpress\\Common\\Models\\Voucher' not found in wp-content/plugins/voucherify/src/Voucherify/Wordpress/Handlers/DiscountVouchers/DiscountVoucher.php:8

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for browser errors
No browser issues were found

Optimizations

Plugin configuration Passed 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: integration, voucherify, rspective, api, woocommerce

voucherify/voucherify.php Passed 13 tests

"Voucherify" version 3.0.0's primary PHP file adds more information about the plugin and serves as the entry point for WordPress
79 characters long description:
Integrates Voucherify API with woocommerce replacing core coupons functionality

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | There should be no dangerous file extensions present in any WordPress plugin
Everything looks great! No dangerous files found in this plugin8,890 lines of code in 128 files:
LanguageFilesBlank linesComment linesLines of code
PHP1171,9562,1377,724
Markdown21570723
PO File26973188
JSON30087
JavaScript115082
CSS213167
XML10019

PHP code Passed 2 tests

This is a very shot review of cyclomatic complexity and code structure
Everything seems fine, there were no complexity issues found
Cyclomatic complexity
Average complexity per logical line of code0.20
Average class complexity5.87
▷ Minimum class complexity1.00
▷ Maximum class complexity47.00
Average method complexity1.71
▷ Minimum method complexity1.00
▷ Maximum method complexity18.00
Code structure
Namespaces14
Interfaces0
Traits0
Classes98
▷ Abstract classes77.14%
▷ Concrete classes9192.86%
▷ Final classes00.00%
Methods617
▷ Static methods6210.05%
▷ Public methods53486.55%
▷ Protected methods294.70%
▷ Private methods548.75%
Functions31
▷ Named functions1651.61%
▷ Anonymous functions1548.39%
Constants9
▷ Global constants444.44%
▷ Class constants555.56%
▷ Public constants5100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

It is recommended to compress PNG files in your plugin to minimize bandwidth usage
1 PNG file occupies 0.04MB with 0.03MB in potential savings
Potential savings
Compression of 1 random PNG file using pngquant
FileSize - originalSize - compressedSavings
vendor/rspective/voucherify/docs/images/voucherify-php-sdk.png42.99KB11.62KB▼ 72.98%