57% woo-pdf-invoice-builder

Code Review | WooCommerce PDF Invoice Builder, Create invoices, packing slips and more

WordPress plugin WooCommerce PDF Invoice Builder, Create invoices, packing slips and more scored57%from 54 tests.

About plugin

  • Plugin page: woo-pdf-invoice-b...
  • Plugin version: 1.2.108
  • PHP version: 7.4.16
  • WordPress compatibility: 3.3-6.4.1
  • WordPress version: 6.3.1
  • First release: Nov 3, 2017
  • Latest release: Nov 28, 2023
  • Number of updates: 376
  • Update frequency: every 5.9 days
  • Top authors: EDGARROJAS (100%)

Code review

54 tests

User reviews

121 reviews

Install metrics

3,000+ active /164,253 total downloads

Benchmarks

Plugin footprint 65% from 16 tests

Installer Passed 1 test

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

Server metrics [RAM: ▲0.39MB] [CPU: ▼7.56ms] Passed 4 tests

This is a short check of server-side resources used by WooCommerce PDF Invoice Builder, Create invoices, packing slips and more
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /3.84 ▲0.3735.85 ▼8.56
Dashboard /wp-admin3.76 ▲0.4048.00 ▼11.62
Posts /wp-admin/edit.php3.81 ▲0.4549.33 ▲1.83
Add New Post /wp-admin/post-new.php6.30 ▲0.4194.10 ▼11.90
Media Library /wp-admin/upload.php3.62 ▲0.3838.70 ▲4.39
Blank page/500 error resolver /wp-admin/admin.php?page=woo-pdf-invoice-builder/woocommerce-pdf-invoice.phperrorresolver3.6036.70
WC Invoice /wp-admin/admin.php?page=wc_invoice_menu3.6135.57
Documentation/Help /wp-admin/admin.php?page=woo-pdf-invoice-builder/woocommerce-pdf-invoice.phpwish_list3.5934.48
Manage Invoices /wp-admin/admin.php?page=woo-pdf-invoice-builder/woocommerce-pdf-invoice.phpmanage_invoices3.5934.45

Server storage [IO: ▲26.26MB] [DB: ▲0.01MB] 67% from 3 tests

A short overview of filesystem and database impact
It is recommended to fix the following issues
  • The filesystem usage should be lower than 25MB (currently using 26.26MB)
Filesystem: 997 new files
Database: 3 new tables, 7 new options
New tables
wp_rednao_wc_invoices_created
wp_rednao_wc_invoices_custom_field
wp_rednao_wc_invoice
New WordPress options
can_compress_scripts
theysaidso_admin_options
widget_recent-comments
db_upgraded
widget_recent-posts
WC_PDF_INVOICE_LATEST_DB_VERSION
widget_theysaidso_widget

Browser metrics Passed 4 tests

An overview of browser requirements for WooCommerce PDF Invoice Builder, Create invoices, packing slips and more
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,841 ▲7913.88 ▼0.831.72 ▲0.0737.05 ▼1.26
Dashboard /wp-admin2,243 ▲665.84 ▲0.26109.50 ▲6.8342.26 ▼3.51
Posts /wp-admin/edit.php2,152 ▲522.83 ▲0.8846.33 ▲7.5635.17 ▼0.51
Add New Post /wp-admin/post-new.php1,574 ▲4823.77 ▲0.81630.24 ▼33.4733.05 ▼23.22
Media Library /wp-admin/upload.php1,452 ▲525.35 ▲1.16103.42 ▲1.2841.73 ▼2.26
Blank page/500 error resolver /wp-admin/admin.php?page=woo-pdf-invoice-builder/woocommerce-pdf-invoice.phperrorresolver1,0522.5137.1776.51
WC Invoice /wp-admin/admin.php?page=wc_invoice_menu1,0402.3932.7440.02
Documentation/Help /wp-admin/admin.php?page=woo-pdf-invoice-builder/woocommerce-pdf-invoice.phpwish_list8332.3230.9926.21
Manage Invoices /wp-admin/admin.php?page=woo-pdf-invoice-builder/woocommerce-pdf-invoice.phpmanage_invoices1,0428.89192.8138.43

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

🔸 Tests weight: 35 | All plugins must uninstall correctly, removing their source code and extra database tables they might have created
These items require your attention
  • Zombie tables were found after uninstall: 3 tables
    • wp_rednao_wc_invoices_created
    • wp_rednao_wc_invoices_custom_field
    • wp_rednao_wc_invoice
  • Zombie WordPress options were found after uninstall: 7 options
    • widget_recent-posts
    • widget_theysaidso_widget
    • can_compress_scripts
    • WC_PDF_INVOICE_LATEST_DB_VERSION
    • theysaidso_admin_options
    • db_upgraded
    • widget_recent-comments

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a short smoke test looking for server-side errors
Good news, no errors were detected

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 items
  • 6× PHP files perform the action of outputting non-empty strings when accessed directly:
    • > /wp-content/plugins/woo-pdf-invoice-builder/pages/custom_field_list.php
    • > /wp-content/plugins/woo-pdf-invoice-builder/test2.php
    • > /wp-content/plugins/woo-pdf-invoice-builder/pages/documentation.php
    • > /wp-content/plugins/woo-pdf-invoice-builder/vendor/phpqrcode/index.php
    • > /wp-content/plugins/woo-pdf-invoice-builder/pages/invoice_list.php
    • > /wp-content/plugins/woo-pdf-invoice-builder/vendor/sabberworm/php-css-parser/tests/quickdump.php
  • 355× PHP files trigger server-side errors or warnings when accessed directly (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'rnwcinv\\htmlgenerator\\fields\\subfields\\PDFSubFieldBase' not found in wp-content/plugins/woo-pdf-invoice-builder/htmlgenerator/fields/subfields/BillingSubFields/PDFBillingAddress.php:5
    • > PHP Fatal error
      Uncaught Error: Class 'PrintNode\\Entity' not found in wp-content/plugins/woo-pdf-invoice-builder/vendor/printnode/printnode-php/src/PrintNode/ApiKey.php:12
    • > PHP Fatal error
      Uncaught Error: Class 'PDFConverterBase' not found in wp-content/plugins/woo-pdf-invoice-builder/smarty/converter/PDFPaymentMethodConverter.php:2
    • > PHP Fatal error
      Uncaught Error: Interface 'Svg\\Surface\\SurfaceInterface' not found in wp-content/plugins/woo-pdf-invoice-builder/vendor/phenx/php-svg-lib/src/Svg/Surface/SurfaceCpdf.php:14
    • > PHP Fatal error
      Uncaught Error: Class 'FontLib\\Glyph\\Outline' not found in wp-content/plugins/woo-pdf-invoice-builder/vendor/phenx/php-font-lib/src/FontLib/Glyph/OutlineSimple.php:17
    • > PHP Fatal error
      Uncaught Error: Class 'Smarty_Internal_CompileBase' not found in wp-content/plugins/woo-pdf-invoice-builder/vendor/smarty/sysplugins/smarty_internal_compile_call.php:17
    • > PHP Fatal error
      Uncaught Error: Class 'FontLib\\Table\\DirectoryEntry' not found in wp-content/plugins/woo-pdf-invoice-builder/vendor/phenx/php-font-lib/src/FontLib/TrueType/TableDirectoryEntry.php:18
    • > PHP Fatal error
      Uncaught Error: Class 'rnwcinv\\htmlgenerator\\fields\\subfields\\PDFSubFieldBase' not found in wp-content/plugins/woo-pdf-invoice-builder/htmlgenerator/fields/subfields/PDFInvDate.php:5
    • > PHP Fatal error
      Uncaught Error: Class 'Dompdf\\FrameReflower\\Block' not found in wp-content/plugins/woo-pdf-invoice-builder/vendor/dompdf/dompdf/src/FrameReflower/TableCell.php:18
    • > PHP Fatal error
      Uncaught Error: Class 'rnwcinv\\htmlgenerator\\fields\\PDFTable' not found in wp-content/plugins/woo-pdf-invoice-builder/htmlgenerator/fields/test/TestPDFTable.php:5

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 93% from 29 tests

readme.txt Passed 16 tests

The readme.txt file uses markdown syntax to describe your plugin to the world
5 plugin tags: pdf, invoices, woocommerce pdf invoice, woocommerce invoice, woocommerce

woo-pdf-invoice-builder/woocommerce-pdf-invoice.php 85% from 13 tests

The primary PHP file in "WooCommerce PDF Invoice Builder, Create invoices, packing slips and more" version 1.2.108 is used by WordPress to initiate all plugin functionality
It is important to fix the following:
  • Text Domain: The text domain name should consist of only dashes and lowercase characters
  • Main file name: Even though not officially enforced, the main plugin file should be the same as the plugin slug ("woo-pdf-invoice-builder.php" instead of "woocommerce-pdf-invoice.php")

Code Analysis 0% from 3 tests

File types 0% from 1 test

🔸 Test weight: 35 | This is an overview of file extensions present in this plugin and a short test that no dangerous files are bundled with this plugin
Please make sure to remedy the following
  • You should never include executable (binary) or otherwise dangerous files in your plugin
    • .bat - Batch File in Windows
      • wp-content/plugins/woo-pdf-invoice-builder/vendor/phpqrcode/tools/merge.bat
133,508 lines of code in 811 files:
LanguageFilesBlank linesComment linesLines of code
PHP59216,50632,007100,735
JavaScript833,2772,38120,250
CSS583382154,691
SVG12003,161
HTML1326411,838
JSON19301,098
Markdown1131901,031
TypeScript12532327
XML532186
Smarty1210139
YAML312248
Bourne Shell1002
DOS Batch1002

PHP code 0% from 2 tests

This is a very shot review of cyclomatic complexity and code structure
The following items need your attention
  • Class cyclomatic complexity has to be reduced to less than 1000 (currently 1,487)
  • Cyclomatic complexity of methods has to be reduced to less than 100 (currently 651)
Cyclomatic complexity
Average complexity per logical line of code0.43
Average class complexity26.09
▷ Minimum class complexity1.00
▷ Maximum class complexity1,487.00
Average method complexity4.48
▷ Minimum method complexity1.00
▷ Maximum method complexity651.00
Code structure
Namespaces55
Interfaces7
Traits0
Classes552
▷ Abstract classes305.43%
▷ Concrete classes52294.57%
▷ Final classes30.57%
Methods4,119
▷ Static methods3097.50%
▷ Public methods3,49284.78%
▷ Protected methods3678.91%
▷ Private methods2606.31%
Functions90
▷ Named functions6572.22%
▷ Anonymous functions2527.78%
Constants595
▷ Global constants11318.99%
▷ Class constants48281.01%
▷ Public constants482100.00%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
36 PNG files occupy 0.50MB with 0.23MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
images/orderActions/view.png0.38KB0.50KB0.00%
images/fullonly.png3.85KB1.16KB▼ 69.86%
images/toolIcons/separator.png2.80KB0.11KB▼ 96.20%
js/templates/PackingSlip.png10.76KB3.62KB▼ 66.32%
images/toolIcons/start.png0.62KB0.88KB0.00%