67% food-and-drink-menu

Code Review | Five Star Restaurant Menu and Food Ordering

WordPress plugin Five Star Restaurant Menu and Food Ordering scored67%from 54 tests.

About plugin

  • Plugin page: food-and-drink-menu
  • Plugin version: 2.4.12
  • PHP version: 7.4.16
  • WordPress compatibility: 6.0-6.4
  • WordPress version: 6.3.1
  • First release: Dec 6, 2013
  • Latest release: Nov 8, 2023
  • Number of updates: 158
  • Update frequency: every 22.9 days
  • Top authors: Rustaurius (58.23%)NateWr (42.41%)

Code review

54 tests

User reviews

99 reviews

Install metrics

7,000+ active /350,204 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | The install procedure must perform silently
The plugin installed gracefully, with no errors

Server metrics [RAM: ▲1.72MB] [CPU: ▲5.16ms] Passed 4 tests

An overview of server-side resources used by Five Star Restaurant Menu and Food Ordering
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /5.17 ▲1.7047.97 ▲6.79
Dashboard /wp-admin5.05 ▲1.7161.50 ▼3.04
Posts /wp-admin/edit.php5.11 ▲1.7570.85 ▲22.60
Add New Post /wp-admin/post-new.php7.84 ▲1.95104.61 ▲2.79
Media Library /wp-admin/upload.php4.95 ▲1.7247.30 ▲14.11
Five-Star Restaurant Menu - Welcome! /wp-admin/index.php?page=fdm-getting-started4.9446.50
Dashboard /wp-admin/edit.php?post_type=fdm-menu&page=fdm-dashboard4.9649.46
Menus /wp-admin/edit.php?post_type=fdm-menu5.0354.81
Menu Sections /wp-admin/edit-tags.php?taxonomy=fdm-menu-section&post_type=fdm-menu-item4.9750.89
Menu Items /wp-admin/edit.php?post_type=fdm-menu-item5.0556.55
About Us /wp-admin/edit.php?post_type=fdm-menu&page=fdm-about-us4.9548.70
Export /wp-admin/edit.php?post_type=fdm-menu&page=fdm-export4.9547.27
Settings /wp-admin/edit.php?post_type=fdm-menu&page=food-and-drink-menu-settings4.9646.98
Import /wp-admin/edit.php?post_type=fdm-menu&page=fdm-import4.9564.15

Server storage [IO: ▲8.94MB] [DB: ▲0.01MB] Passed 3 tests

A short overview of filesystem and database impact
No storage issues were detected
Filesystem: 1,134 new files
Database: no new tables, 11 new options
New WordPress options
food-and-drink-menu-settings
widget_recent-posts
widget_recent-comments
can_compress_scripts
db_upgraded
widget_fdm_widget_menu
fdm-installation-time
widget_fdm_widget_menu_item
theysaidso_admin_options
widget_theysaidso_widget
...

Browser metrics Passed 4 tests

Five Star Restaurant Menu and Food Ordering: an overview of browser usage
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,029 ▲28214.39 ▲0.051.52 ▼0.1637.33 ▼9.08
Dashboard /wp-admin2,425 ▲2456.18 ▲0.58119.09 ▲26.5441.23 ▲0.38
Posts /wp-admin/edit.php2,356 ▲2563.37 ▲1.3849.95 ▲11.0534.42 ▼0.81
Add New Post /wp-admin/post-new.php6,481 ▲4,95528.73 ▲5.52909.75 ▲180.6138.75 ▼12.20
Media Library /wp-admin/upload.php1,487 ▲934.36 ▲0.1695.02 ▼3.4740.41 ▼0.26
Five-Star Restaurant Menu - Welcome! /wp-admin/index.php?page=fdm-getting-started1,2793.0943.2233.88
Dashboard /wp-admin/edit.php?post_type=fdm-menu&page=fdm-dashboard1,4973.6550.29109.79
Menus /wp-admin/edit.php?post_type=fdm-menu1,4373.6960.8736.50
Menu Sections /wp-admin/edit-tags.php?taxonomy=fdm-menu-section&post_type=fdm-menu-item1,6203.6649.0040.83
Menu Items /wp-admin/edit.php?post_type=fdm-menu-item1,4573.8653.6937.09
About Us /wp-admin/edit.php?post_type=fdm-menu&page=fdm-about-us1,6463.4544.7059.72
Export /wp-admin/edit.php?post_type=fdm-menu&page=fdm-export1,1743.4247.4938.68
Settings /wp-admin/edit.php?post_type=fdm-menu&page=food-and-drink-menu-settings2,02410.07299.3941.28
Import /wp-admin/edit.php?post_type=fdm-menu&page=fdm-import1,1713.4347.4537.07

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
It is recommended to fix the following
  • Zombie WordPress options were found after uninstall: 11 options
    • widget_recent-comments
    • widget_fdm_widget_menu
    • widget_fdm_widget_menu_item
    • fdm-permission-level
    • fdm-installation-time
    • widget_recent-posts
    • widget_theysaidso_widget
    • can_compress_scripts
    • db_upgraded
    • food-and-drink-menu-settings
    • ...

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
Everything seems fine, however this is by no means an exhaustive test

SRP 0% 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
Almost there! Just fix the following items
  • 3× PHP files output non-empty strings when accessed directly via GET requests:
    • > /wp-content/plugins/food-and-drink-menu/fdm-templates/content/related_item_price.php
    • > /wp-content/plugins/food-and-drink-menu/lib/stripe/build.php
    • > /wp-content/plugins/food-and-drink-menu/lib/stripe/update_certs.php
  • 568× GET requests to PHP files trigger server-side errors or Error 500 responses (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Using $this when not in object context in wp-content/plugins/food-and-drink-menu/fdm-templates/admin-order-form.php:3
    • > PHP Fatal error
      Uncaught Error: Class 'PhpOffice\\PhpSpreadsheet\\Calculation\\Engineering\\ConvertBase' not found in wp-content/plugins/food-and-drink-menu/lib/PHPSpreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Engineering/ConvertDecimal.php:8
    • > PHP Fatal error
      Uncaught Error: Class 'Stripe\\ApiResource' not found in wp-content/plugins/food-and-drink-menu/lib/stripe/lib/Invoice.php:110
    • > PHP Fatal error
      Uncaught Error: Class 'Stripe\\StripeObject' not found in wp-content/plugins/food-and-drink-menu/lib/stripe/lib/AttachedObject.php:12
    • > PHP Fatal error
      Uncaught Error: Class 'PHPUnit_Framework_TestCase' not found in wp-content/plugins/food-and-drink-menu/lib/stripe/tests/TestCase.php:9
    • > PHP Fatal error
      Uncaught Error: Interface 'Stripe\\Exception\\ExceptionInterface' not found in wp-content/plugins/food-and-drink-menu/lib/stripe/lib/Exception/InvalidArgumentException.php:5
    • > PHP Fatal error
      Uncaught Error: Class 'PhpOffice\\PhpSpreadsheet\\Writer\\Xlsx\\WriterPart' not found in wp-content/plugins/food-and-drink-menu/lib/PHPSpreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xlsx/Workbook.php:12
    • > PHP Fatal error
      Uncaught Error: Class 'PhpOffice\\PhpSpreadsheet\\Reader\\Ods\\BaseLoader' not found in wp-content/plugins/food-and-drink-menu/lib/PHPSpreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Ods/DefinedNames.php:9
    • > PHP Fatal error
      Uncaught Error: Class 'Stripe\\ApiResource' not found in wp-content/plugins/food-and-drink-menu/lib/stripe/lib/LineItem.php:21
    • > PHP Fatal error
      Trait 'PhpOffice\\PhpSpreadsheet\\Calculation\\ArrayEnabled' not found in wp-content/plugins/food-and-drink-menu/lib/PHPSpreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/MathTrig/Ceiling.php on line 10

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

readme.txt 94% from 16 tests

It's important to format your readme.txt file correctly as it is parsed for the public listing of your plugin
These attributes need your attention:
  • Tags: Please reduce the number of tags, currently 16 tag instead of maximum 10
You can take inspiration from this readme.txt

food-and-drink-menu/food-and-drink-menu.php Passed 13 tests

The main PHP script in "Five Star Restaurant Menu and Food Ordering" version 2.4.12 is automatically included on every request by WordPress
140 characters long description:
Restaurant menu and food ordering system that is easy to set up and includes blocks, patterns and shortcodes for integration with any theme.

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
  • Do not include executable or dangerous files in your plugin
    • .crt - Security Certificate in Firefox, IE, Chrome, Safari
      • wp-content/plugins/food-and-drink-menu/lib/stripe/data/ca-certificates.crt
111,854 lines of code in 1,045 files:
LanguageFilesBlank linesComment linesLines of code
PHP89922,63151,53397,876
CSS264193106,365
JavaScript821,1445724,536
Markdown1261002,149
JSON700362
LESS65439330
YAML72212102
XML40066
SVG10044
Bourne Again Shell16324

PHP code 0% from 2 tests

A short review of cyclomatic complexity and code structure
Please fix the following
  • Class cyclomatic complexity should be reduced to less than 1000 (currently 1,020)
  • Method cyclomatic complexity has to be reduced to less than 100 (currently 333)
Cyclomatic complexity
Average complexity per logical line of code0.36
Average class complexity17.32
▷ Minimum class complexity1.00
▷ Maximum class complexity1,020.00
Average method complexity3.24
▷ Minimum method complexity1.00
▷ Maximum method complexity333.00
Code structure
Namespaces95
Interfaces22
Traits8
Classes817
▷ Abstract classes435.26%
▷ Concrete classes77494.74%
▷ Final classes20.26%
Methods6,191
▷ Static methods1,79028.91%
▷ Public methods4,73476.47%
▷ Protected methods2594.18%
▷ Private methods1,19819.35%
Functions89
▷ Named functions2022.47%
▷ Anonymous functions6977.53%
Constants2,125
▷ Global constants160.75%
▷ Class constants2,10999.25%
▷ Public constants1,94292.08%

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
36 PNG files occupy 1.72MB with 0.95MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
lib/simple-admin-pages/img/options-asset-star.png0.78KB0.32KB▼ 58.92%
assets/img/options-asset-star.png0.78KB0.32KB▼ 58.92%
lib/simple-admin-pages/img/options-asset-info.png0.84KB0.42KB▼ 49.53%
lib/simple-admin-pages/img/options-asset-exclamation.png2.44KB1.39KB▼ 43.07%
assets/img/icons/item-flags-64.png45.13KB16.40KB▼ 63.67%