84% visma-pay-embedded-card-payment-gateway

Code Review | Visma Pay (Embedded Card) for Woocommerce

WordPress plugin Visma Pay (Embedded Card) for Woocommerce scored84%from 54 tests.

About plugin

  • Plugin page: visma-pay-embedde...
  • Plugin version: 1.1.2
  • PHP version: 7.4.16
  • WordPress compatibility: 3.0.0-6.3.1
  • WordPress version: 6.3.1
  • First release: Jan 21, 2021
  • Latest release: Oct 4, 2023
  • Number of updates: 15
  • Update frequency: every 65.8 days
  • Top authors: hsuvant (100%)

Code review

54 tests

User reviews

1 review

Install metrics

100+ active /1,852 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | All plugins must install correctly, without throwing any errors, warnings, or notices
The plugin installed successfully, without throwing any errors or notices

Server metrics [RAM: ▲0.19MB] [CPU: ▼4.13ms] Passed 4 tests

Analyzing server-side resources used by Visma Pay (Embedded Card) for Woocommerce
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /3.65 ▲0.1933.90 ▼8.70
Dashboard /wp-admin3.49 ▲0.1944.80 ▼5.08
Posts /wp-admin/edit.php3.60 ▲0.2547.13 ▼3.40
Add New Post /wp-admin/post-new.php6.07 ▲0.1991.86 ▲7.79
Media Library /wp-admin/upload.php3.41 ▲0.1933.88 ▲0.65

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

Input-output and database impact of this plugin
This plugin was installed successfully
Filesystem: 23 new files
Database: no new tables, 6 new options
New WordPress options
db_upgraded
widget_recent-comments
widget_theysaidso_widget
can_compress_scripts
widget_recent-posts
theysaidso_admin_options

Browser metrics Passed 4 tests

An overview of browser requirements for Visma Pay (Embedded Card) for Woocommerce
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,800 ▲5413.32 ▼0.864.71 ▲2.9735.19 ▼9.21
Dashboard /wp-admin2,206 ▲155.88 ▲1.02107.23 ▼8.8142.63 ▼2.70
Posts /wp-admin/edit.php2,089 ▲32.06 ▲0.0639.29 ▲4.1335.53 ▲2.98
Add New Post /wp-admin/post-new.php1,542 ▲2818.23 ▲0.79586.24 ▼131.5761.90 ▼6.00
Media Library /wp-admin/upload.php1,385 ▼34.19 ▼0.0297.01 ▼4.2740.06 ▼1.70

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
  • Zombie WordPress options were found after uninstall: 6 options
    • widget_recent-comments
    • widget_recent-posts
    • theysaidso_admin_options
    • can_compress_scripts
    • widget_theysaidso_widget
    • db_upgraded

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a short smoke test looking for server-side errors
The smoke test was a success, however most plugin functionality was not tested

SRP 50% from 2 tests

🔹 Tests weight: 20 | The single-responsibility principle applies for WordPress plugins as well - please make sure your PHP files perform no actions when accessed directly
Please take a closer look at the following
  • 2× GET requests to PHP files have triggered server-side errors or warnings:
    • > PHP Fatal error
      Uncaught Error: Class 'Automattic\\WooCommerce\\Blocks\\Payments\\Integrations\\AbstractPaymentMethodType' not found in wp-content/plugins/visma-pay-embedded-card-payment-gateway/includes/blocks/visma_pay_embedded_card_blocks_support.php:5
    • > PHP Fatal error
      Uncaught Error: Interface 'Visma\\VismaPayConnector' not found in wp-content/plugins/visma-pay-embedded-card-payment-gateway/includes/lib/Visma/VismaPayWPConnector.php: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)
There were no browser issues found

Optimizations

Plugin configuration 93% from 29 tests

readme.txt 94% from 16 tests

Often overlooked, readme.txt is one of the most important files in your plugin
Attributes that require attention:
  • Donate link: Invalid URI ("")
The official readme.txt might help

visma-pay-embedded-card-payment-gateway/visma-pay-embedded-card-payment-gateway.php 92% from 13 tests

Analyzing the main PHP file in "Visma Pay (Embedded Card) for Woocommerce" version 1.1.2
It is important to fix the following:
  • Requires at least: Required version must match the one declared in readme.txt ("3.3" instead of "3.0.0")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | Executable files are considered dangerous and should not be included with any WordPress plugin
Everything looks great! No dangerous files found in this plugin1,669 lines of code in 14 files:
LanguageFilesBlank linesComment linesLines of code
PHP8227261,215
PO File194103278
JavaScript2154122
CSS17046
XML1007
JSON1001

PHP code Passed 2 tests

A short review of cyclomatic complexity and code structure
There are no cyclomatic complexity problems detected for this plugin
Cyclomatic complexity
Average complexity per logical line of code0.35
Average class complexity27.67
▷ Minimum class complexity1.00
▷ Maximum class complexity140.00
Average method complexity4.33
▷ Minimum method complexity1.00
▷ Maximum method complexity47.00
Code structure
Namespaces1
Interfaces1
Traits0
Classes5
▷ Abstract classes00.00%
▷ Concrete classes5100.00%
▷ Final classes120.00%
Methods49
▷ Static methods36.12%
▷ Public methods4081.63%
▷ Protected methods918.37%
▷ Private methods00.00%
Functions5
▷ Named functions360.00%
▷ Anonymous functions240.00%
Constants1
▷ Global constants00.00%
▷ Class constants1100.00%
▷ Public constants1100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

PNG files should be compressed to save space and minimize bandwidth usage
6 PNG files occupy 0.08MB with 0.03MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/images/verified.png60.95KB33.67KB▼ 44.76%
assets/images/americanexpress.png6.79KB3.73KB▼ 44.99%
assets/images/dinersclub.png4.04KB2.31KB▼ 42.78%
assets/images/visa.png4.17KB2.54KB▼ 39.07%
assets/images/securecode.png1.48KB0.85KB▼ 42.84%