46% wc-transbank-webpay-plus-rest

Code Review | Migración de Medio de Pago Webpay Plus SOAP a REST de Transbank para WooCommerce

WordPress plugin Migración de Medio de Pago Webpay Plus SOAP a REST de Transbank para WooCommerce scored46%from 54 tests.

About plugin

  • Plugin page: wc-transbank-webp...
  • Plugin version: 2021.03.22
  • PHP version: 7.4.16
  • WordPress compatibility: 3.4.0-5.6
  • WordPress version: 6.3.1
  • First release: Dec 3, 2020
  • Latest release: Mar 21, 2021
  • Number of updates: 8
  • Update frequency: every 13.4 days
  • Top authors: andresreyesdev (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /1,026 total downloads

Benchmarks

Plugin footprint 47% 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.00MB] [CPU: ▼2.66ms] Passed 4 tests

Server-side resources used by Migración de Medio de Pago Webpay Plus SOAP a REST de Transbank para WooCommerce
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /3.47 ▲0.0039.31 ▼1.86
Dashboard /wp-admin3.31 ▲0.0047.22 ▼0.80
Posts /wp-admin/edit.php3.36 ▲0.0044.96 ▼1.62
Add New Post /wp-admin/post-new.php5.89 ▲0.0084.54 ▼5.42
Media Library /wp-admin/upload.php3.23 ▲0.0034.54 ▼1.74

Server storage [IO: ▲31.67MB] [DB: ▲0.00MB] 67% from 3 tests

Analyzing filesystem and database footprints of this plugin
Just a few items left to fix
  • The filesystem usage should be lower than 25MB (currently using 31.67MB)
Filesystem: 704 new files
Database: no new tables, 6 new options
New WordPress options
widget_recent-comments
theysaidso_admin_options
db_upgraded
widget_recent-posts
widget_theysaidso_widget
can_compress_scripts

Browser metrics Passed 4 tests

This is an overview of browser requirements for Migración de Medio de Pago Webpay Plus SOAP a REST de Transbank para WooCommerce
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,825 ▲7914.42 ▼0.222.05 ▲0.2544.33 ▼1.74
Dashboard /wp-admin2,206 ▲185.83 ▼0.0297.43 ▼4.7939.18 ▼2.75
Posts /wp-admin/edit.php2,089 ▼02.06 ▲0.0636.26 ▼0.5932.36 ▼2.66
Add New Post /wp-admin/post-new.php1,537 ▲923.12 ▲4.96683.39 ▲86.2248.06 ▼2.95
Media Library /wp-admin/upload.php1,388 ▼04.20 ▼0.0792.53 ▼15.7540.98 ▼4.55

Uninstaller [IO: ▲31.67MB] [DB: ▲0.00MB] 25% from 4 tests

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
It is recommended to fix the following
  • Uninstall procedure validation failed for this plugin
    • > Error in wp-content/plugins/wc-transbank-webpay-plus-rest/wc-transbank-webpay-plus-rest.php+304
    Uncaught Error: Class 'Transbank\WooCommerce\WebpayRest\TransbankWebpayOrders' not found in wp-content/plugins/wc-transbank-webpay-plus-rest/wc-transbank-webpay-plus-rest.php:304
    Stack trace:
    #0 wp-includes/class-wp-hook.php(310): transbank_rest_remove_database()
    #1 wp-includes/class-wp-hook.php(334): WP_Hook->apply_filters()
    #2 wp-includes/plugin.php(517): WP_Hook->do_action()
    #3 wp-admin/includes/plugin.php(1269): do_action()
    #4 wp-admin/includes/plugin.php(960): uninstall_plugin()
  • Incomplete uninstall procedure, leaving 704 files (31.67MB) in the plugin directory
    • (new file) libwebpay/css/ReportPdf.css
    • (new file) assets/img/back.png
    • (new file) composer.json
    • (new file) libwebpay/admin-options.php
    • (new file) assets/img/whatsapp.svg
    • (new file) libwebpay/ConfigProvider.php
    • (new file) libwebpay/images/webpay.png
    • (new file) assets/img/logo_webpay.png
    • (new file) readme.txt
    • (new file) composer.lock
    • ...
  • This plugin does not fully uninstall, leaving 7 options in the database
    • db_upgraded
    • recovery_mode_email_last_sent
    • widget_recent-comments
    • can_compress_scripts
    • widget_theysaidso_widget
    • widget_recent-posts
    • 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
The smoke test was a success, however most plugin functionality was not tested

SRP 0% from 2 tests

🔹 Tests weight: 20 | SRP (Single-Responsibility Principle) - PHP files must act as libraries and never output text or perform any action when accessed directly in a browser
Please fix the following
  • 82× PHP files perform the task of outputting text when accessed with GET requests (only 10 are shown):
    • > /wp-content/plugins/wc-transbank-webpay-plus-rest/vendor/tecnickcom/tcpdf/examples/example_034.php
    • > /wp-content/plugins/wc-transbank-webpay-plus-rest/vendor/tecnickcom/tcpdf/examples/example_054.php
    • > /wp-content/plugins/wc-transbank-webpay-plus-rest/vendor/tecnickcom/tcpdf/examples/barcodes/example_1d_png.php
    • > /wp-content/plugins/wc-transbank-webpay-plus-rest/vendor/tecnickcom/tcpdf/examples/example_031.php
    • > /wp-content/plugins/wc-transbank-webpay-plus-rest/vendor/tecnickcom/tcpdf/examples/example_064.php
    • > /wp-content/plugins/wc-transbank-webpay-plus-rest/vendor/tecnickcom/tcpdf/examples/example_020.php
    • > /wp-content/plugins/wc-transbank-webpay-plus-rest/vendor/tecnickcom/tcpdf/examples/example_004.php
    • > /wp-content/plugins/wc-transbank-webpay-plus-rest/vendor/tecnickcom/tcpdf/examples/example_011.php
    • > /wp-content/plugins/wc-transbank-webpay-plus-rest/vendor/tecnickcom/tcpdf/examples/barcodes/example_2d_qrcode_png.php
    • > /wp-content/plugins/wc-transbank-webpay-plus-rest/vendor/tecnickcom/tcpdf/examples/barcodes/example_1d_html.php
  • 106× GET requests to PHP files have triggered server-side errors or warnings (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Call to a member function format() on null in wp-content/plugins/wc-transbank-webpay-plus-rest/views/order-summary.php:25
    • > PHP Notice
      Undefined variable: finalResponse in wp-content/plugins/wc-transbank-webpay-plus-rest/views/order-summary.php on line 17
    • > PHP Fatal error
      Uncaught Error: Class 'PHPUnit\\Framework\\TestCase' not found in wp-content/plugins/wc-transbank-webpay-plus-rest/vendor/transbank/transbank-sdk/tests/OnepaySignUtilTest.php:13
    • > PHP Fatal error
      Uncaught Error: Class 'Transbank\\Onepay\\BaseResponse' not found in wp-content/plugins/wc-transbank-webpay-plus-rest/vendor/transbank/transbank-sdk/lib/onepay/TransactionCreateResponse.php:12
    • > PHP Fatal error
      Uncaught Error: Interface 'Psr\\Http\\Message\\StreamInterface' not found in wp-content/plugins/wc-transbank-webpay-plus-rest/vendor/guzzlehttp/psr7/src/LazyOpenStream.php:10
    • > PHP Fatal error
      Uncaught Error: Interface 'GuzzleHttp\\Promise\\PromiseInterface' not found in wp-content/plugins/wc-transbank-webpay-plus-rest/vendor/guzzlehttp/promises/src/Promise.php:9
    • > PHP Fatal error
      Uncaught Error: Class 'GuzzleHttp\\Exception\\TransferException' not found in wp-content/plugins/wc-transbank-webpay-plus-rest/vendor/guzzlehttp/guzzle/src/Exception/RequestException.php:12
    • > PHP Fatal error
      Uncaught Error: Class 'Transbank\\Onepay\\Exceptions\\TransbankException' not found in wp-content/plugins/wc-transbank-webpay-plus-rest/vendor/transbank/transbank-sdk/lib/onepay/exceptions/RefundCreateException.php:10
    • > PHP Fatal error
      Uncaught Error: Interface 'GuzzleHttp\\Exception\\GuzzleException' not found in wp-content/plugins/wc-transbank-webpay-plus-rest/vendor/guzzlehttp/guzzle/src/Exception/TransferException.php:4
    • > PHP Fatal error
      Uncaught Error: Interface 'GuzzleHttp\\Promise\\PromisorInterface' not found in wp-content/plugins/wc-transbank-webpay-plus-rest/vendor/guzzlehttp/guzzle/src/Pool.php:20

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
Everything seems fine on the user side

Optimizations

Plugin configuration 87% from 29 tests

readme.txt 88% from 16 tests

Often overlooked, readme.txt is one of the most important files in your plugin
These attributes need your attention:
  • Requires php: Version not formatted correctly
  • Tags: There are too many tags (14 tag instead of maximum 10)
The official readme.txt is a good inspiration

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

The entry point to "Migración de Medio de Pago Webpay Plus SOAP a REST de Transbank para WooCommerce" version 2021.03.22 is a PHP file that has certain tags in its header comment area
Please make the necessary changes and fix the following:
  • Plugin Name: Please shorten the plugin name (currently 81 characters long instead of max. 70)
  • Requires at least: Required version must be the same as the one declared in readme.txt ("4.0" instead of "3.4.0")

Code Analysis 0% from 3 tests

File types 0% from 1 test

🔸 Test weight: 35 | This is a short overview of programming languages used in this plugin, detecting executable files
These items require your attention
  • Do not distribute dangerous files with your plugin
    • .crt - Security Certificate in Firefox, IE, Chrome, Safari
      • wp-content/plugins/wc-transbank-webpay-plus-rest/vendor/tecnickcom/tcpdf/examples/data/cert/tcpdf.crt
83,055 lines of code in 540 files:
LanguageFilesBlank linesComment linesLines of code
PHP4978,78525,80576,269
Markdown181,14103,552
SVG4111,883
JSON12001,223
CSS15047
make212028
Dockerfile28022
XML10015
YAML20014
Bourne Shell1102

PHP code 0% from 2 tests

Analyzing logical lines of code, cyclomatic complexity, and other code metrics
The following items need your attention
  • Class cyclomatic complexity has to be reduced to less than 1000 (currently 4,379)
  • Please reduce cyclomatic complexity of methods to less than 100 (currently 502)
Cyclomatic complexity
Average complexity per logical line of code0.34
Average class complexity27.65
▷ Minimum class complexity1.00
▷ Maximum class complexity4,379.00
Average method complexity4.60
▷ Minimum method complexity1.00
▷ Maximum method complexity502.00
Code structure
Namespaces34
Interfaces15
Traits2
Classes305
▷ Abstract classes00.00%
▷ Concrete classes305100.00%
▷ Final classes196.23%
Methods2,464
▷ Static methods42317.17%
▷ Public methods2,01281.66%
▷ Protected methods29812.09%
▷ Private methods1546.25%
Functions214
▷ Named functions12257.01%
▷ Anonymous functions9242.99%
Constants371
▷ Global constants18249.06%
▷ Class constants18950.94%
▷ Public constants189100.00%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
10 PNG files occupy 0.70MB with 0.25MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/img/logo_webpay.png14.54KB6.90KB▼ 52.53%
vendor/tecnickcom/tcpdf/examples/images/tcpdf_cell.png37.51KB36.62KB▼ 2.39%
libwebpay/images/webpay.png5.89KB2.46KB▼ 58.20%
vendor/tecnickcom/tcpdf/examples/images/img.png190.57KB64.69KB▼ 66.06%
vendor/tecnickcom/tcpdf/examples/images/alpha.png23.33KB30.34KB0.00%