84% gopay-gateway

Code Review | GoPay for WooCommerce

WordPress plugin GoPay for WooCommerce scored84%from 54 tests.

About plugin

  • Plugin page: gopay-gateway
  • Plugin version: 1.0.4
  • PHP compatiblity: 7.4+
  • PHP version: 7.4.16
  • WordPress compatibility: 5.0-6.0
  • WordPress version: 6.3.1
  • First release: Nov 1, 2022
  • Latest release: Sep 27, 2023
  • Number of updates: 15
  • Update frequency: every 22.0 days
  • Top authors: gopayplugins (100%)

Code review

54 tests

User reviews

1 review

Install metrics

400+ active /1,933 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
Install script ran successfully

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

This is a short check of server-side resources used by GoPay for WooCommerce
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /3.51 ▲0.0038.73 ▼11.49
Dashboard /wp-admin3.35 ▲0.0054.12 ▼1.08
Posts /wp-admin/edit.php3.40 ▲0.0045.81 ▼1.02
Add New Post /wp-admin/post-new.php5.93 ▲0.0086.17 ▼0.51
Media Library /wp-admin/upload.php3.27 ▲0.0035.10 ▼2.39

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

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

Browser metrics Passed 4 tests

An overview of browser requirements for GoPay for WooCommerce
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,800 ▲5414.44 ▼0.232.39 ▲0.5143.04 ▼4.93
Dashboard /wp-admin2,206 ▲184.88 ▼1.03111.72 ▲1.7438.81 ▼3.49
Posts /wp-admin/edit.php2,089 ▼32.01 ▼0.0140.38 ▲2.7136.30 ▲4.04
Add New Post /wp-admin/post-new.php1,542 ▲923.17 ▲0.12655.98 ▼26.4462.28 ▲7.30
Media Library /wp-admin/upload.php1,385 ▼64.17 ▼0.0397.48 ▼5.9942.03 ▼2.75

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
  • The uninstall procedure has failed, leaving 6 options in the database
    • theysaidso_admin_options
    • widget_theysaidso_widget
    • can_compress_scripts
    • widget_recent-comments
    • widget_recent-posts
    • db_upgraded

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
Good news, no errors were detected

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
The following issues need your attention
  • 99× GET requests to PHP files trigger server-side errors or Error 500 responses (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'GuzzleHttp\\Exception\\BadResponseException' not found in wp-content/plugins/gopay-gateway/vendor/guzzlehttp/guzzle/src/Exception/ServerException.php:7
    • > PHP Fatal error
      Uncaught Error: Interface 'Psr\\Http\\Message\\StreamInterface' not found in wp-content/plugins/gopay-gateway/vendor/guzzlehttp/psr7/src/InflateStream.php:20
    • > PHP Fatal error
      Uncaught Error: Class 'GoPay\\GivenGoPay' not found in wp-content/plugins/gopay-gateway/vendor/gopay/payments-sdk-php/tests/remote/WhenApiFailedTest.php:7
    • > PHP Fatal error
      Uncaught Error: Interface 'Psr\\Http\\Message\\StreamInterface' not found in wp-content/plugins/gopay-gateway/vendor/guzzlehttp/psr7/src/LazyOpenStream.php:13
    • > PHP Fatal error
      Uncaught Error: Class 'PHPUnit_Framework_TestCase' not found in wp-content/plugins/gopay-gateway/vendor/gopay/payments-sdk-php/tests/remote/GivenGoPay.php:8
    • > PHP Fatal error
      Uncaught Error: Interface 'Psr\\Http\\Message\\RequestInterface' not found in wp-content/plugins/gopay-gateway/vendor/psr/http-message/src/ServerRequestInterface.php:43
    • > PHP Fatal error
      Uncaught Error: Class 'GuzzleHttp\\Promise\\RejectionException' not found in wp-content/plugins/gopay-gateway/vendor/guzzlehttp/promises/src/AggregateException.php:8
    • > PHP Fatal error
      require_once(): Failed opening required 'wp-content/plugins/gopay-gateway/vendor/gopay/payments-sdk-php/tests/phpunit/../../vendor/autoload.php' (include_path='.:/usr/share/php') in wp-content/plugins/gopay-gateway/vendor/gopay/payments-sdk-php/tests/phpunit/TestUtils.php on line 5
    • > PHP Fatal error
      Uncaught Error: Interface 'Psr\\Http\\Message\\MessageInterface' not found in wp-content/plugins/gopay-gateway/vendor/psr/http-message/src/ResponseInterface.php:20
    • > PHP Fatal error
      Uncaught Error: Class 'GuzzleHttp\\Cookie\\CookieJar' not found in wp-content/plugins/gopay-gateway/vendor/guzzlehttp/guzzle/src/Cookie/FileCookieJar.php:7

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)
No browser issues were found

Optimizations

Plugin configuration 96% from 29 tests

readme.txt Passed 16 tests

You should put a lot of thought into formatting readme.txt as it is used by WordPress.org to prepare the public listing of your plugin
2 plugin tags: woocommerce, gopay

gopay-gateway/gopay-gateway.php 92% from 13 tests

"GoPay for WooCommerce" version 1.0.4's primary PHP file adds more information about the plugin and serves as the entry point for WordPress
Please take the time to fix the following:
  • Requires at least: Required version must be the same as the one declared in readme.txt ("5.4" instead of "5.0")

Code Analysis 97% from 3 tests

File types Passed 1 test

🔸 Test weight: 35 | This is an overview of programming languages used in this plugin; dangerous file extensions are not allowed
Good job! No executable or dangerous file extensions detected40,930 lines of code in 269 files:
LanguageFilesBlank linesComment linesLines of code
PHP2072,9667,12431,965
Markdown191,30803,990
PO File122,92003,217
JSON13001,392
YAML7234127
CSS32612124
XML24042
make217040
Dockerfile211016
JavaScript142014
Bourne Shell1203

PHP code 50% from 2 tests

An overview of cyclomatic complexity and code structure
These items need your attention
  • Cyclomatic complexity of methods has to be reduced to less than 100 (currently 179)
Cyclomatic complexity
Average complexity per logical line of code0.43
Average class complexity12.35
▷ Minimum class complexity1.00
▷ Maximum class complexity179.00
Average method complexity3.09
▷ Minimum method complexity1.00
▷ Maximum method complexity179.00
Code structure
Namespaces22
Interfaces19
Traits2
Classes145
▷ Abstract classes00.00%
▷ Concrete classes145100.00%
▷ Final classes2416.55%
Methods946
▷ Static methods21422.62%
▷ Public methods77481.82%
▷ Protected methods212.22%
▷ Private methods15115.96%
Functions172
▷ Named functions8046.51%
▷ Anonymous functions9253.49%
Constants363
▷ Global constants5114.05%
▷ Class constants31285.95%
▷ Public constants312100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

All PNG images should be compressed to minimize bandwidth usage for end users
1 PNG file occupies 0.06MB with 0.06MB in potential savings
Potential savings
Compression of 1 random PNG file using pngquant
FileSize - originalSize - compressedSavings
includes/assets/images/gopay.png60.40KB3.38KB▼ 94.40%