77% transbank-webpay-plus-rest

Code Review | Transbank Webpay REST

WordPress plugin Transbank Webpay REST scored77%from 54 tests.

About plugin

  • Plugin page: transbank-webpay-...
  • Plugin version: 1.6.8
  • PHP compatiblity: 7.0+
  • PHP version: 7.4.16
  • WordPress compatibility: 3.4.0-5.8
  • WordPress version: 6.3.1
  • First release: Dec 17, 2020
  • Latest release: Apr 18, 2023
  • Number of updates: 30
  • Update frequency: every 28.4 days
  • Top authors: transbankdevelopers (100%)

Code review

54 tests

User reviews

6 reviews

Install metrics

10,000+ active /81,770 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
Installer ran successfully

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

This is a short check of server-side resources used by Transbank Webpay REST
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /3.47 ▲0.0034.35 ▼11.62
Dashboard /wp-admin3.31 ▲0.0048.69 ▼6.56
Posts /wp-admin/edit.php3.36 ▲0.0049.42 ▼0.27
Add New Post /wp-admin/post-new.php5.89 ▲0.0086.63 ▼15.68
Media Library /wp-admin/upload.php3.23 ▲0.0036.43 ▲0.09

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

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

Browser metrics Passed 4 tests

An overview of browser requirements for Transbank Webpay REST
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,800 ▲5414.48 ▲0.132.30 ▲0.4941.04 ▼5.40
Dashboard /wp-admin2,203 ▲185.78 ▼0.08101.04 ▼16.9341.04 ▼5.01
Posts /wp-admin/edit.php2,086 ▼32.04 ▲0.0637.91 ▲2.7832.33 ▼0.97
Add New Post /wp-admin/post-new.php1,514 ▼817.75 ▼5.31596.72 ▼217.4458.92 ▼5.30
Media Library /wp-admin/upload.php1,388 ▲64.22 ▼0.0495.34 ▼1.6943.65 ▲1.53

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

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a short smoke test looking for 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
The following issues need your attention
  • 4× PHP files output non-empty strings when accessed directly via GET requests:
    • > /wp-content/plugins/transbank-webpay-plus-rest/views/admin/components/info-validacion-webpay-oneclick-box.php
    • > /wp-content/plugins/transbank-webpay-plus-rest/vendor/transbank/transbank-sdk/examples/index.php
    • > /wp-content/plugins/transbank-webpay-plus-rest/views/admin/components/credenciales-box.php
    • > /wp-content/plugins/transbank-webpay-plus-rest/views/admin/components/info-validacion-webpay-plus-box.php
  • 253× PHP files trigger server errors when accessed directly (only 10 are shown):
    • > PHP Warning
      require_once(wp-content/plugins/transbank-webpay-plus-rest/vendor/transbank/transbank-sdk/tests/../vendor/autoload.php): failed to open stream: No such file or directory in wp-content/plugins/transbank-webpay-plus-rest/vendor/transbank/transbank-sdk/tests/bootstrap.php on line 3
    • > PHP Fatal error
      Trait 'Transbank\\Utils\\InteractsWithWebpayApi' not found in wp-content/plugins/transbank-webpay-plus-rest/vendor/transbank/transbank-sdk/src/Webpay/Oneclick/MallInscription.php on line 16
    • > PHP Fatal error
      Uncaught Error: Interface 'Psr\\Http\\Message\\StreamInterface' not found in wp-content/plugins/transbank-webpay-plus-rest/vendor/guzzlehttp/psr7/src/LazyOpenStream.php:13
    • > PHP Fatal error
      Uncaught Error: Class 'Transbank\\Webpay\\WebpayPlus\\Responses\\TransactionCreateResponse' not found in wp-content/plugins/transbank-webpay-plus-rest/vendor/transbank/transbank-sdk/src/Webpay/WebpayPlus/Responses/MallTransactionCreateResponse.php:5
    • > PHP Fatal error
      Uncaught Error: Interface 'Monolog\\Processor\\ProcessorInterface' not found in wp-content/plugins/transbank-webpay-plus-rest/vendor/monolog/monolog/src/Monolog/Processor/UidProcessor.php:21
    • > PHP Fatal error
      Uncaught Error: Class 'Psr\\Log\\AbstractLogger' not found in wp-content/plugins/transbank-webpay-plus-rest/vendor/psr/log/Psr/Log/Test/TestLogger.php:57
    • > PHP Fatal error
      Uncaught Error: Class 'Transbank\\Utils\\EnvironmentManager' not found in wp-content/plugins/transbank-webpay-plus-rest/vendor/transbank/transbank-sdk/src/Patpass/PatpassComercio.php:13
    • > PHP Fatal error
      Uncaught Error: Interface 'Psr\\Log\\LoggerInterface' not found in wp-content/plugins/transbank-webpay-plus-rest/vendor/psr/log/Psr/Log/AbstractLogger.php:12
    • > PHP Fatal error
      Uncaught Error: Interface 'Transbank\\Contracts\\RequestService' not found in wp-content/plugins/transbank-webpay-plus-rest/vendor/transbank/transbank-sdk/src/Utils/HttpClientRequestService.php:13
    • > PHP Fatal error
      Uncaught Error: Interface 'Monolog\\Processor\\ProcessorInterface' not found in wp-content/plugins/transbank-webpay-plus-rest/vendor/monolog/monolog/src/Monolog/Processor/TagProcessor.php:19

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for browser errors
Everything seems fine on the user side

Optimizations

Plugin configuration 90% 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: The official readme.txt is a good inspiration

transbank-webpay-plus-rest/webpay-rest.php 85% from 13 tests

The main PHP script in "Transbank Webpay REST" version 1.6.8 is automatically included on every request by WordPress
You should first fix the following items:
  • Requires at least: Required version must match the one declared in readme.txt ("4.0" instead of "3.4.0")
  • Main file name: Name the main plugin file the same as the plugin slug ("transbank-webpay-plus-rest.php" instead of "webpay-rest.php")

Code Analysis 97% from 3 tests

File types Passed 1 test

🔸 Test weight: 35 | Executable files are considered dangerous and should not be included with any WordPress plugin
Good job! No executable or dangerous file extensions detected74,921 lines of code in 518 files:
LanguageFilesBlank linesComment linesLines of code
PHP4466,31513,45044,216
SVG40116,123
CSS163,695698,469
Markdown211,40404,247
JSON14001,528
YAML8273166
JavaScript231093
XML20034
Dockerfile28021
make18019
Bourne Shell2305

PHP code 50% from 2 tests

This is a short overview of cyclomatic complexity and code structure for this plugin
These items need your attention
  • Method cyclomatic complexity has to be reduced to less than 100 (currently 179)
Cyclomatic complexity
Average complexity per logical line of code0.34
Average class complexity8.52
▷ Minimum class complexity1.00
▷ Maximum class complexity179.00
Average method complexity2.32
▷ Minimum method complexity1.00
▷ Maximum method complexity179.00
Code structure
Namespaces63
Interfaces27
Traits11
Classes359
▷ Abstract classes82.23%
▷ Concrete classes35197.77%
▷ Final classes257.12%
Methods2,256
▷ Static methods32214.27%
▷ Public methods1,84481.74%
▷ Protected methods1807.98%
▷ Private methods23210.28%
Functions206
▷ Named functions8943.20%
▷ Anonymous functions11756.80%
Constants364
▷ Global constants4311.81%
▷ Class constants32188.19%
▷ Public constants321100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

PNG files should be compressed to save space and minimize bandwidth usage
2 PNG files occupy 0.01MB with 0.01MB in potential savings
Potential savings
Compression of 2 random PNG files using pngquant
FileSize - originalSize - compressedSavings
images/webpay.png3.97KB2.10KB▼ 47.22%
images/webpay-new.png10.96KB4.79KB▼ 56.25%