78% wphobby-pdf-invoices-for-woocommerce

Code Review | WooCommerce PDF Invoices Maker

WordPress plugin WooCommerce PDF Invoices Maker scored78%from 54 tests.

About plugin

  • Plugin page: wphobby-pdf-invoi...
  • Plugin version: 1.2.7
  • PHP version: 7.4.16
  • WordPress compatibility: 4.0-6.2
  • WordPress version: 6.3.1
  • First release: Sep 19, 2019
  • Latest release: Mar 30, 2023
  • Number of updates: 43
  • Update frequency: every 30.0 days
  • Top authors: darell (100%)

Code review

54 tests

User reviews

1 review

Install metrics

20+ active /2,114 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

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

Server metrics [RAM: ▲0.00MB] [CPU: ▼11.66ms] Passed 4 tests

This is a short check of server-side resources used by WooCommerce PDF Invoices Maker
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /3.48 ▲0.0236.31 ▼4.28
Dashboard /wp-admin3.32 ▼0.0344.74 ▼14.74
Posts /wp-admin/edit.php3.37 ▲0.0145.95 ▼6.11
Add New Post /wp-admin/post-new.php5.90 ▲0.0179.42 ▼21.50
Media Library /wp-admin/upload.php3.24 ▲0.0137.82 ▲5.87

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

A short overview of filesystem and database impact
No storage issues were detected
Filesystem: 368 new files
Database: no new tables, 6 new options
New WordPress options
theysaidso_admin_options
widget_theysaidso_widget
widget_recent-comments
db_upgraded
widget_recent-posts
can_compress_scripts

Browser metrics Passed 4 tests

This is an overview of browser requirements for WooCommerce PDF Invoices Maker
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,795 ▲3414.28 ▼0.391.90 ▲0.2143.82 ▼0.27
Dashboard /wp-admin2,195 ▲155.54 ▼0.0784.96 ▲0.5236.56 ▼1.83
Posts /wp-admin/edit.php2,107 ▲72.02 ▼0.0139.55 ▼1.4836.35 ▼3.04
Add New Post /wp-admin/post-new.php1,534 ▲823.30 ▲0.26656.35 ▲10.8366.48 ▲13.62
Media Library /wp-admin/upload.php1,406 ▲64.14 ▼0.04101.15 ▼9.6644.82 ▼0.32

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
It is recommended to fix the following
  • This plugin does not fully uninstall, leaving 6 options in the database
    • db_upgraded
    • widget_theysaidso_widget
    • theysaidso_admin_options
    • widget_recent-comments
    • can_compress_scripts
    • widget_recent-posts

Smoke tests 50% 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)
Even though no errors were found, this is by no means an exhaustive test

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 take a closer look at the following
  • 1× PHP files output non-empty strings when accessed directly via GET requests:
    • > /wp-content/plugins/wphobby-pdf-invoices-for-woocommerce/lib/dompdf/lib/php-css-parser/tests/quickdump.php
  • 147× PHP files trigger errors when accessed directly with GET requests (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'Dompdf\\FrameReflower\\AbstractFrameReflower' not found in wp-content/plugins/wphobby-pdf-invoices-for-woocommerce/lib/dompdf/src/FrameReflower/TableRow.php:20
    • > PHP Fatal error
      Uncaught Error: Class 'Dompdf\\FrameDecorator\\AbstractFrameDecorator' not found in wp-content/plugins/wphobby-pdf-invoices-for-woocommerce/lib/dompdf/src/FrameDecorator/Block.php:20
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_html() in wp-content/plugins/wphobby-pdf-invoices-for-woocommerce/includes/admin/sections/general/tab-server.php:22
    • > PHP Fatal error
      Uncaught Error: Interface 'Dompdf\\Canvas' not found in wp-content/plugins/wphobby-pdf-invoices-for-woocommerce/lib/dompdf/src/Adapter/CPDF.php:37
    • > PHP Fatal error
      Uncaught Error: Class 'Svg\\Style' not found in wp-content/plugins/wphobby-pdf-invoices-for-woocommerce/lib/dompdf/lib/php-svg-lib/src/Svg/DefaultStyle.php:11
    • > PHP Fatal error
      Uncaught Error: Class 'Dompdf\\Frame' not found in wp-content/plugins/wphobby-pdf-invoices-for-woocommerce/lib/dompdf/src/FrameDecorator/AbstractFrameDecorator.php:30
    • > PHP Fatal error
      Uncaught Error: Interface 'Dompdf\\Canvas' not found in wp-content/plugins/wphobby-pdf-invoices-for-woocommerce/lib/dompdf/src/Adapter/PDFLib.php:34
    • > PHP Fatal error
      Uncaught Error: Class 'FontLib\\Table\\Table' not found in wp-content/plugins/wphobby-pdf-invoices-for-woocommerce/lib/dompdf/lib/php-font-lib/src/FontLib/Table/Type/os2.php:17
    • > PHP Fatal error
      Uncaught Error: Call to undefined function do_action() in wp-content/plugins/wphobby-pdf-invoices-for-woocommerce/templates/invoice/invoice.php:12
    • > PHP Fatal error
      Uncaught Error: Class 'Svg\\Tag\\Shape' not found in wp-content/plugins/wphobby-pdf-invoices-for-woocommerce/lib/dompdf/lib/php-svg-lib/src/Svg/Tag/Path.php:13

User-side errors Passed 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the browser (console and network errors and warnings)
Everything seems fine on the user side

Optimizations

Plugin configuration 96% from 29 tests

readme.txt Passed 16 tests

The readme.txt file describes your plugin functionality and requirements and it is parsed to prepare the your plugin's listing
8 plugin tags: order, pdf, packing slip, billing, invoice...

wphobby-pdf-invoices-for-woocommerce/wphobby-woo-pdf-invoice.php 92% from 13 tests

The principal PHP file in "WooCommerce PDF Invoices Maker" v. 1.2.7 is loaded by WordPress automatically on each request
You should first fix the following items:
  • Main file name: Even though not officially enforced, the main plugin file should be the same as the plugin slug ("wphobby-pdf-invoices-for-woocommerce.php" instead of "wphobby-woo-pdf-invoice.php")

Code Analysis 97% from 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
Success! There were no dangerous files found in this plugin54,731 lines of code in 279 files:
LanguageFilesBlank linesComment linesLines of code
PHP2108,62815,68547,537
CSS412,1551225,622
Markdown62550909
XML632201
SVG313186
JSON500139
YAML416365
JavaScript316355
HTML10017

PHP code 50% from 2 tests

Analyzing logical lines of code, cyclomatic complexity, and other code metrics
These items need your attention
  • Method cyclomatic complexity should be reduced to less than 100 (currently 652)
Cyclomatic complexity
Average complexity per logical line of code0.42
Average class complexity34.92
▷ Minimum class complexity1.00
▷ Maximum class complexity765.00
Average method complexity4.24
▷ Minimum method complexity1.00
▷ Maximum method complexity652.00
Code structure
Namespaces33
Interfaces5
Traits0
Classes182
▷ Abstract classes126.59%
▷ Concrete classes17093.41%
▷ Final classes00.00%
Methods2,019
▷ Static methods814.01%
▷ Public methods1,72885.59%
▷ Protected methods1929.51%
▷ Private methods994.90%
Functions45
▷ Named functions3066.67%
▷ Anonymous functions1533.33%
Constants163
▷ Global constants84.91%
▷ Class constants15595.09%
▷ Public constants155100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Using a strong compression for your PNG files is a great way to speed-up your plugin
6 PNG files occupy 0.07MB with 0.03MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/images/default-logo.png17.10KB2.94KB▼ 82.80%
includes/admin/images/icon.png19.99KB0.88KB▼ 95.61%
assets/images/file.png5.09KB3.92KB▼ 22.99%
lib/dompdf/lib/res/broken_image.png0.60KB0.47KB▼ 22.33%
assets/images/mail.png16.25KB13.04KB▼ 19.74%