77% igms-direct-booking

Code Review | iGMS Direct Booking

WordPress plugin iGMS Direct Booking scored77%from 54 tests.

About plugin

  • Plugin page: igms-direct-booking
  • Plugin version: 1.3
  • PHP compatiblity: 5.6+
  • PHP version: 7.4.16
  • WordPress compatibility: 5.6 @todo define wordpress version-6.3.1
  • WordPress version: 6.3.1
  • First release: Mar 10, 2021
  • Latest release: Sep 26, 2023
  • Number of updates: 87
  • Update frequency: every 10.7 days
  • Top authors: igms (100%)

Code review

54 tests

User reviews

1 review

Install metrics

100+ active /1,873 total downloads

Benchmarks

Plugin footprint 82% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Verifying that this plugin installs correctly without errors
The plugin installed gracefully, with no errors

Server metrics [RAM: ▼0.01MB] [CPU: ▲1,236.67ms] 75% from 4 tests

Analyzing server-side resources used by iGMS Direct Booking
It is recommended to improve the following
  • Extra CPU: Extra CPU usage should be kept under 200.00ms (currently 1,236.67ms on /wp-admin/upload.php)
PageMemory (MB)CPU Time (ms)
Home /3.63 ▲0.1740.46 ▲0.40
Dashboard /wp-admin3.34 ▲0.041,659.34 ▲1,610.82
Posts /wp-admin/edit.php3.45 ▲0.101,718.23 ▲1,669.70
Add New Post /wp-admin/post-new.php5.61 ▼0.281,780.51 ▲1,680.91
Media Library /wp-admin/upload.php3.35 ▲0.121,699.87 ▲1,665.77

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

A short overview of filesystem and database impact
The plugin installed successfully
Filesystem: 29 new files
Database: no new tables, 15 new options
New WordPress options
widget_recent-posts
direct_booking_widget_uuid
direct_booking_widget_profile_name
can_compress_scripts
widget_theysaidso_widget
direct_booking_reservation_widget_book_now_button_text
direct_booking_reservation_widget_check_availability_button_text
widget_idbw_direct_booking_reservation_widget
direct_booking_widget_profile_email
direct_booking_widget_color
...

Browser metrics Passed 4 tests

Checking browser requirements for iGMS Direct Booking
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,864 ▲9313.66 ▼0.722.07 ▲0.1040.32 ▼4.72
Dashboard /wp-admin2,228 ▲375.86 ▼0.0495.60 ▼10.5566.85 ▲20.74
Posts /wp-admin/edit.php2,126 ▲342.02 ▼0.0235.49 ▼4.7031.41 ▼7.19
Add New Post /wp-admin/post-new.php6,272 ▲4,73919.67 ▼3.77936.65 ▲263.3936.01 ▼32.96
Media Library /wp-admin/upload.php1,422 ▲344.24 ▲0.1093.35 ▼7.30100.39 ▲57.68

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
  • This plugin does not fully uninstall, leaving 15 options in the database
    • widget_recent-posts
    • direct_booking_widget_uuid
    • direct_booking_widget_profile_name
    • db_upgraded
    • widget_idbw_direct_booking_reservation_widget
    • widget_theysaidso_widget
    • direct_booking_widget_user_uid
    • direct_booking_reservation_widget_book_now_button_text
    • direct_booking_reservation_widget_check_availability_button_text
    • can_compress_scripts
    • ...

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 everything seems fine, this is not 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
The following issues need your attention
  • 1× PHP files perform the task of outputting text when accessed with GET requests:
    • > /wp-content/plugins/igms-direct-booking/view/reservation-widget-form.php
  • 12× PHP files trigger errors when accessed directly with GET requests (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Call to undefined function register_activation_hook() in wp-content/plugins/igms-direct-booking/includes/register-activation-hook.php:3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function register_uninstall_hook() in wp-content/plugins/igms-direct-booking/includes/register-uninstall-hook.php:2
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/igms-direct-booking/view/direct-booking-settings-page.php:3
    • > PHP Fatal error
      Uncaught Error: Class 'IDBW_DataTransferObject' not found in wp-content/plugins/igms-direct-booking/dataTransferObjects/IDBW_PropertyDTO.php:9
    • > PHP Fatal error
      require_once(): Failed opening required 'IGMS_DIRECT_BOOKING_WIDGET_ROOT/view/direct-booking-settings-page.php' (include_path='.:/usr/share/php') in wp-content/plugins/igms-direct-booking/settings/IDBW_Settings.php on line 3
    • > PHP Warning
      Use of undefined constant IGMS_DIRECT_BOOKING_WIDGET_ROOT - assumed 'IGMS_DIRECT_BOOKING_WIDGET_ROOT' (this will throw an Error in a future version of PHP) in wp-content/plugins/igms-direct-booking/settings/IDBW_Settings.php on line 3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/igms-direct-booking/includes/register-direct-booking-reservation-widget.php:9
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/igms-direct-booking/includes/register-reservation-widget-block.php:3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/igms-direct-booking/view/direct-booking-settings-page.php:3
    • > PHP Warning
      require_once(IGMS_DIRECT_BOOKING_WIDGET_ROOT/view/direct-booking-settings-page.php): failed to open stream: No such file or directory in wp-content/plugins/igms-direct-booking/settings/IDBW_Settings.php on line 3

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
There were no browser issues found

Optimizations

Plugin configuration 93% from 29 tests

readme.txt Passed 16 tests

Often overlooked, readme.txt is one of the most important files in your plugin
6 plugin tags: reservations, airbnb, reservation widget, direct booking, booking...

igms-direct-booking/igms-direct-booking.php 85% from 13 tests

The main file in "iGMS Direct Booking" v. 1.3 serves as a complement to information provided in readme.txt and as the entry point to the plugin
It is important to fix the following:
  • Requires at least: Please use periods and digits for the required version (ex. "7.0" instead of "5.6 @todo define wordpress version")
  • Text Domain: Since WordPress version 4.6 the text domain is optional; if specified, it must be the same as the plugin slug

Code Analysis Passed 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
Good job! No executable or dangerous file extensions detected1,264 lines of code in 22 files:
LanguageFilesBlank linesComment linesLines of code
PHP192112821,259
SVG1003
JavaScript2002

PHP code Passed 2 tests

An overview of cyclomatic complexity and code structure
Although this was not an exhaustive test, there were no cyclomatic complexity issues detected
Cyclomatic complexity
Average complexity per logical line of code0.22
Average class complexity2.90
▷ Minimum class complexity1.00
▷ Maximum class complexity6.00
Average method complexity1.37
▷ Minimum method complexity1.00
▷ Maximum method complexity6.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes10
▷ Abstract classes110.00%
▷ Concrete classes990.00%
▷ Final classes00.00%
Methods53
▷ Static methods3464.15%
▷ Public methods5298.11%
▷ Protected methods00.00%
▷ Private methods11.89%
Functions9
▷ Named functions777.78%
▷ Anonymous functions222.22%
Constants31
▷ Global constants26.45%
▷ Class constants2993.55%
▷ Public constants29100.00%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

It is recommended to compress PNG files in your plugin to minimize bandwidth usage
5 PNG files occupy 0.93MB with 0.56MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/screenshot-3.png182.99KB73.67KB▼ 59.74%
assets/screenshot-2.png170.00KB72.36KB▼ 57.43%
assets/screenshot-4.png186.54KB73.49KB▼ 60.60%
assets/screenshot-1.png244.14KB87.69KB▼ 64.08%
assets/screenshot-5.png165.34KB66.52KB▼ 59.77%