93% mpdf-addon-for-pdf-invoices

Code Review | mPDF add-on for PDF Invoices, Packing Slips, Delivery Notes & Shipping Labels by WebToffee

WordPress plugin mPDF add-on for PDF Invoices, Packing Slips, Delivery Notes & Shipping Labels by WebToffee scored 93% from 54 tests.

About plugin

  • Plugin page: mpdf-addon-for-pd...
  • Plugin version: 1.0.6
  • PHP compatiblity: 5.6+
  • PHP version: 7.4.16
  • WordPress compatibility: 3.0.1-5.9
  • WordPress version: 5.9.2
  • First release: Sep 7, 2020
  • Latest release: Apr 4, 2022
  • Number of updates: 11
  • Update frequency: every 52.5 days
  • Top authors: webtoffee (100%)

Code review

54 tests

User reviews

6 reviews

Install metrics

1,000+ active / 8,758 total downloads

Benchmarks

Plugin footprint Passed 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Verifying that this plugin installs correctly without errors
Install script ran successfully

Server metrics [RAM: ▼0.02MB] [CPU: ▼285.47ms] Passed 4 tests

This is a short check of server-side resources used by mPDF add-on for PDF Invoices, Packing Slips, Delivery Notes & Shipping Labels by WebToffee
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /3.52 ▲0.0174.06 ▲8.54
Dashboard /wp-admin3.41 ▲0.0035.28 ▼7.57
Posts /wp-admin/edit.php3.64 ▼0.0058.89 ▲9.66
Add New Post /wp-admin/post-new.php6.89 ▼0.08150.49 ▼1,136.54
Media Library /wp-admin/upload.php3.30 ▲0.0033.10 ▼6.32

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

How much does this plugin use your filesystem and database?
It is recommended to fix the following issues
  • Total filesystem usage must be limited to 25MB (currently using 92.18MB)
Filesystem: 630 new files
Database: no new tables, no new options

Browser metrics Passed 4 tests

mPDF add-on for PDF Invoices, Packing Slips, Delivery Notes & Shipping Labels by WebToffee: an overview of browser usage
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,829 ▲8515.72 ▲0.208.14 ▼1.753.33 ▼0.13
Dashboard /wp-admin2,963 ▲436.39 ▼0.06181.72 ▼20.67203.26 ▼7.61
Posts /wp-admin/edit.php2,718 ▼03.43 ▲0.0181.53 ▼5.84171.43 ▼12.00
Add New Post /wp-admin/post-new.php1,754 ▲2816.94 ▼3.95664.54 ▲68.15223.35 ▲16.26
Media Library /wp-admin/upload.php1,730 ▼05.71 ▼0.01182.81 ▼2.19247.67 ▼15.66

Uninstaller [IO: ▲0.00MB] [DB: ▲0.00MB] Passed 4 tests

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
Uninstall script ran successfully

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
Even though everything seems fine, this is not an exhaustive test

SRP 50% from 2 tests

🔹 Tests weight: 20 | A shallow check of the single-responsibility principle; PHP files should perform no action - including output of placeholder text - and trigger no errors when accessed directly
Please take a closer look at the following
  • 210× PHP files trigger server errors when accessed directly (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Interface 'Psr\\Log\\LoggerAwareInterface' not found in wp-content/plugins/mpdf-addon-for-pdf-invoices/vendor/mpdf/mpdf/src/SizeConverter.php:8
    • > PHP Fatal error
      Uncaught Error: Class 'Mpdf\\Tag\\Td' not found in wp-content/plugins/mpdf-addon-for-pdf-invoices/vendor/mpdf/mpdf/src/Tag/Th.php:5
    • > PHP Fatal error
      Trait 'Mpdf\\Strict' not found in wp-content/plugins/mpdf-addon-for-pdf-invoices/vendor/mpdf/mpdf/src/Writer/PageWriter.php on line 9
    • > PHP Fatal error
      Uncaught Error: Interface 'Psr\\Log\\LoggerAwareInterface' not found in wp-content/plugins/mpdf-addon-for-pdf-invoices/vendor/mpdf/mpdf/src/Writer/MetadataWriter.php:14
    • > PHP Fatal error
      Uncaught Error: Class 'Mpdf\\Barcode\\AbstractBarcode' not found in wp-content/plugins/mpdf-addon-for-pdf-invoices/vendor/mpdf/mpdf/src/Barcode/Codabar.php:9
    • > PHP Notice
      Undefined index: filename in wp-content/plugins/mpdf-addon-for-pdf-invoices/vendor/mpdf/mpdf/data/out.php on line 5
    • > PHP Fatal error
      Uncaught Error: Class 'Mpdf\\Tag\\Tag' not found in wp-content/plugins/mpdf-addon-for-pdf-invoices/vendor/mpdf/mpdf/src/Tag/BarCode.php:5
    • > PHP Fatal error
      Uncaught Error: Class 'Mpdf\\Tag\\Tag' not found in wp-content/plugins/mpdf-addon-for-pdf-invoices/vendor/mpdf/mpdf/src/Tag/WatermarkImage.php:5
    • > PHP Fatal error
      Uncaught Error: Class 'setasign\\Fpdi\\PdfParser\\Type\\PdfType' not found in wp-content/plugins/mpdf-addon-for-pdf-invoices/vendor/setasign/fpdi/src/PdfParser/Type/PdfBoolean.php:17
    • > PHP Fatal error
      Uncaught Error: Interface 'Psr\\Log\\LoggerAwareInterface' not found in wp-content/plugins/mpdf-addon-for-pdf-invoices/vendor/mpdf/mpdf/src/Mpdf.php:36

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for browser errors
Everything seems fine, but this is not an exhaustive test

Optimizations

Plugin configuration 90% from 29 tests

readme.txt 94% from 16 tests

You should put a lot of thought into formatting readme.txt as it is used by WordPress.org to prepare the public listing of your plugin
Please fix the following attributes:
  • Tags: You are using too many tags: 12 tag instead of maximum 10
You can take inspiration from this readme.txt

mpdf-addon-for-pdf-invoices/wt-woocommerce-packing-list-mpdf.php 85% from 13 tests

This is the main PHP file of "mPDF add-on for PDF Invoices, Packing Slips, Delivery Notes & Shipping Labels by WebToffee" version 1.0.6, providing information about the plugin in the header fields and serving as the principal entry point to the plugin's functions
You should first fix the following items:
  • Main file name: Name the main plugin file the same as the plugin slug ("mpdf-addon-for-pdf-invoices.php" instead of "wt-woocommerce-packing-list-mpdf.php")
  • Domain Path: The domain path is invalid: folder "/languages" does not exist

Code Analysis 95% from 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short glimpse at programming languages used with this plugin and a check that no dangerous files are present
Success! There were no dangerous files found in this plugin79,174 lines of code in 478 files:
LanguageFilesBlank linesComment linesLines of code
PHP38210,94611,74076,926
Markdown837401,129
JSON79320588
CSS26518405
XML311073
YAML311350
Bourne Shell1203

PHP code 0% from 2 tests

Analyzing cyclomatic complexity and code structure
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.52
Average class complexity60.86
▷ Minimum class complexity1.00
▷ Maximum class complexity7,009.00
Average method complexity13.56
▷ Minimum method complexity1.00
▷ Maximum method complexity460.00
Code structure
Namespaces44
Interfaces10
Traits6
Classes284
▷ Abstract classes93.17%
▷ Concrete classes27596.83%
▷ Final classes134.73%
Methods1,436
▷ Static methods1248.64%
▷ Public methods1,23485.93%
▷ Protected methods694.81%
▷ Private methods1339.26%
Functions34
▷ Named functions1029.41%
▷ Anonymous functions2470.59%
Constants458
▷ Global constants367.86%
▷ Class constants42292.14%
▷ Public constants422100.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.00MB with 0.00MB in potential savings
Potential savings
Compression of 1 random PNG file using pngquant
FileSize - originalSize - compressedSavings
assets/images/webtoffee-logo_small.png4.04KB2.85KB▼ 29.40%