84% paylabs-payment-gateway

Code Review | Paylabs Payment Gateway for Woocommerce

WordPress plugin Paylabs Payment Gateway for Woocommerce scored84%from 54 tests.

About plugin

  • Plugin page: paylabs-payment-g...
  • Plugin version: 1.0.9
  • PHP version: 7.4.16
  • WordPress compatibility: 3.9.1-6.3
  • WordPress version: 6.3.1
  • First release: Sep 19, 2022
  • Latest release: Aug 23, 2023
  • Number of updates: 30
  • Update frequency: every 11.6 days
  • Top authors: paylabs (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /708 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | It is important to correctly install your plugin, without throwing errors or notices
The plugin installed successfully, without throwing any errors or notices

Server metrics [RAM: ▲0.03MB] [CPU: ▼8.69ms] Passed 4 tests

A check of server-side resources used by Paylabs Payment Gateway for Woocommerce
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /3.51 ▲0.0537.67 ▼3.68
Dashboard /wp-admin3.34 ▼0.0045.09 ▼15.64
Posts /wp-admin/edit.php3.40 ▲0.0444.78 ▼3.19
Add New Post /wp-admin/post-new.php5.92 ▲0.0483.27 ▼12.25
Media Library /wp-admin/upload.php3.27 ▲0.0435.52 ▼1.12

Server storage [IO: ▲0.16MB] [DB: ▲0.07MB] Passed 3 tests

Analyzing filesystem and database footprints of this plugin
No storage issues were detected
Filesystem: 24 new files
Database: no new tables, 6 new options
New WordPress options
theysaidso_admin_options
widget_recent-posts
widget_theysaidso_widget
db_upgraded
can_compress_scripts
widget_recent-comments

Browser metrics Passed 4 tests

This is an overview of browser requirements for Paylabs Payment Gateway for Woocommerce
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,789 ▲2814.10 ▼0.251.79 ▼0.0141.01 ▼9.18
Dashboard /wp-admin2,195 ▲155.59 ▼0.0982.03 ▼10.3236.05 ▼3.25
Posts /wp-admin/edit.php2,100 ▼01.98 ▼0.0536.28 ▲2.1230.09 ▼3.92
Add New Post /wp-admin/post-new.php1,535 ▼118.34 ▼4.62613.62 ▼1.3070.24 ▼10.25
Media Library /wp-admin/upload.php1,400 ▲34.19 ▼0.0399.64 ▼0.1841.90 ▼2.83

Uninstaller [IO: ▲0.00MB] [DB: ▲0.07MB] 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
  • Zombie WordPress options were found after uninstall: 6 options
    • can_compress_scripts
    • widget_recent-comments
    • widget_theysaidso_widget
    • widget_recent-posts
    • db_upgraded
    • theysaidso_admin_options

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 | It is important to ensure that your PHP files perform no action when accessed directly, respecting the single-responsibility principle
Please fix the following items
  • 8× GET requests to PHP files trigger server-side errors or Error 500 responses:
    • > PHP Notice
      Undefined variable: order in wp-content/plugins/paylabs-payment-gateway/page/qris.php on line 5
    • > PHP Fatal error
      Uncaught Error: Call to a member function get_id() on null in wp-content/plugins/paylabs-payment-gateway/page/qris.php:5
    • > PHP Fatal error
      Uncaught Error: Call to a member function get_id() on null in wp-content/plugins/paylabs-payment-gateway/page/dana.php:5
    • > PHP Notice
      Undefined variable: order in wp-content/plugins/paylabs-payment-gateway/page/dana.php on line 5
    • > PHP Fatal error
      Uncaught Error: Call to a member function get_id() on null in wp-content/plugins/paylabs-payment-gateway/page/va.php:5
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_header() in wp-content/plugins/paylabs-payment-gateway/templates/pay.php:1
    • > PHP Fatal error
      Uncaught Error: Call to undefined function apply_filters() in wp-content/plugins/paylabs-payment-gateway/paylabs-woocommerce.php:14
    • > PHP Notice
      Undefined variable: order in wp-content/plugins/paylabs-payment-gateway/page/va.php on line 5

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

readme.txt 94% from 16 tests

The readme.txt file is undoubtedly the most important file in your plugin, preparing it for public listing on WordPress.org
Attributes that need to be fixed: Please take inspiration from this readme.txt

paylabs-payment-gateway/paylabs-woocommerce.php 92% from 13 tests

The main PHP file in "Paylabs Payment Gateway for Woocommerce" ver. 1.0.9 adds more information about the plugin and also serves as the entry point for this plugin
The following require your attention:
  • Main file name: Please rename the main PHP file in this plugin to the plugin slug ("paylabs-payment-gateway.php" instead of "paylabs-woocommerce.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | This is a short overview of programming languages used in this plugin, detecting executable files
Everything looks great! No dangerous files found in this plugin1,098 lines of code in 15 files:
LanguageFilesBlank linesComment linesLines of code
PHP132561661,056
Markdown223042

PHP code Passed 2 tests

An overview of cyclomatic complexity and code structure
Everything seems fine, there were no complexity issues found
Cyclomatic complexity
Average complexity per logical line of code0.19
Average class complexity7.71
▷ Minimum class complexity3.00
▷ Maximum class complexity17.00
Average method complexity2.07
▷ Minimum method complexity1.00
▷ Maximum method complexity8.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes7
▷ Abstract classes114.29%
▷ Concrete classes685.71%
▷ Final classes00.00%
Methods46
▷ Static methods24.35%
▷ Public methods4086.96%
▷ Protected methods24.35%
▷ Private methods48.70%
Functions13
▷ Named functions969.23%
▷ Anonymous functions430.77%
Constants3
▷ Global constants00.00%
▷ Class constants3100.00%
▷ Public constants3100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

All PNG images should be compressed to minimize bandwidth usage for end users
7 PNG files occupy 0.11MB with 0.07MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
asset/danabalance.png27.62KB11.85KB▼ 57.09%
asset/maybankva.png19.08KB8.19KB▼ 57.06%
asset/logo-2.png15.29KB4.61KB▼ 69.87%
asset/danamonva.png9.23KB3.69KB▼ 60.04%
asset/sinarmasva.png23.12KB9.04KB▼ 60.92%