10% woo-custom-gateway

Code Review | Woo Custom Gateway

WordPress plugin Woo Custom Gateway scored10%from 54 tests.

About plugin

  • Plugin page: woo-custom-gateway
  • Plugin version: 1.6.1
  • PHP compatiblity: 7.3+
  • PHP version: 7.4.16
  • WordPress compatibility: 3.0.0-6.2
  • WordPress version: 6.3.1
  • First release: Jul 29, 2019
  • Latest release: Jun 11, 2023
  • Number of updates: 63
  • Update frequency: every 28.5 days
  • Top authors: tygalive (100%)

Code review

54 tests

User reviews

21 reviews

Install metrics

2,000+ active /20,051 total downloads

Benchmarks

Plugin footprint 23% from 16 tests

Installer 0% from 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
It is recommended to fix the following installer errors
  • The plugin did not install without errors
    • > User notice in wp-includes/functions.php+5905
    Function map_meta_cap was called incorrectly. The post type woocg-post is not registered, so it may not be reliable to check the capability edit_post against a post of that type. Please see Debugging in WordPress for more information. (This message was added in version 4.4.0.)

Server metrics [RAM: ▲0.35MB] [CPU: ▼1.64ms] Passed 4 tests

Server-side resources used by Woo Custom Gateway
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /3.75 ▲0.2841.61 ▲0.11
Dashboard /wp-admin3.71 ▲0.4149.85 ▼1.15
Posts /wp-admin/edit.php3.76 ▲0.4049.98 ▼0.52
Add New Post /wp-admin/post-new.php6.24 ▲0.3590.20 ▼5.00
Media Library /wp-admin/upload.php3.57 ▲0.3437.26 ▲2.58
About /wp-admin/admin.php?page=woo-custom-gateway-about3.5835.98
Payment Methods /wp-admin/edit.php?post_type=woocg-post3.7243.96
Woo Custom Gateway /wp-admin/admin.php?page=woo-custom-gateway3.4557.30
Add New /wp-admin/post-new.php?post_type=woocg-post3.6951.08

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

Filesystem and database footprint
There were no storage issued detected upon installing this plugin
Filesystem: 261 new files
Database: no new tables, 6 new options
New WordPress options
widget_recent-comments
widget_recent-posts
can_compress_scripts
widget_theysaidso_widget
theysaidso_admin_options
db_upgraded

Browser metrics Passed 4 tests

An overview of browser requirements for Woo Custom Gateway
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,914 ▲16813.22 ▼1.191.69 ▼0.1244.64 ▲1.05
Dashboard /wp-admin2,321 ▲1324.84 ▼0.09105.39 ▼18.2237.06 ▼14.04
Posts /wp-admin/edit.php2,200 ▲1112.07 ▲0.0638.11 ▼0.0333.09 ▲0.69
Add New Post /wp-admin/post-new.php1,607 ▲7323.29 ▲0.15676.01 ▲1.4550.97 ▼3.90
Media Library /wp-admin/upload.php1,502 ▲1144.30 ▲0.14100.09 ▲2.4343.37 ▼2.02
About /wp-admin/admin.php?page=woo-custom-gateway-about1,0842.7829.0554.71
Payment Methods /wp-admin/edit.php?post_type=woocg-post1,7072.0835.1031.49
Woo Custom Gateway /wp-admin/admin.php?page=woo-custom-gateway280.440.073.86
Add New /wp-admin/post-new.php?post_type=woocg-post1,7473.6462.9935.28

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
The following items require your attention
  • This plugin did not uninstall without warnings or errors
    • > Error in wp-content/plugins/woo-custom-gateway/src/Model/Gateway.php+38
    Uncaught Error: Class 'WC_Payment_Gateway' not found in wp-content/plugins/woo-custom-gateway/src/Model/Gateway.php:38
    Stack trace:
    #0 wp-content/plugins/woo-custom-gateway/vendor/composer/ClassLoader.php(576): include()
    #1 wp-content/plugins/woo-custom-gateway/vendor/composer/ClassLoader.php(427): Composer\Autoload\{closure}()
    #2 [internal function]: Composer\Autoload\ClassLoader->loadClass()
    #3 wp-content/plugins/woo-custom-gateway/src/Controller/Admin.php(505): spl_autoload_call()
    #4 wp-includes/class-wp-hook.php(312): RichardMuvirimi\WooCustomGateway\Controller\Admin->on_delete_method()
    #5 wp-includes/class-wp-hook.php(334): WP_Hook->apply_filters()
    #6 wp-includes/plugin.php(517): WP_Hook->do_action()
    #7 wp-includes/post.php(3434): do_action()
    #8 wp-content/plugins/woo-custom-gateway/src/Controller/Plugin.php(107): wp_delete_post()
    #9 /v
  • Incomplete uninstall procedure, leaving 261 files (0.87MB) in the plugin directory
    • (new file) LICENSE.txt
    • (new file) readme.md
    • (new file) src/Controller/Admin.php
    • (new file) src/Controller/Ajax.php
    • (new file) readme.txt
    • (new file) LICENSE
    • (new file) composer.json
    • (new file) languages/woo-custom-gateway.pot
    • (new file) .phpcs.xml
    • (new file) phpunit.xml
    • ...
  • Zombie WordPress options were found after uninstall: 7 options
    • widget_theysaidso_widget
    • widget_recent-comments
    • theysaidso_admin_options
    • recovery_mode_email_last_sent
    • can_compress_scripts
    • db_upgraded
    • widget_recent-posts

Smoke tests 50% 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 | The single-responsibility principle applies for WordPress plugins as well - please make sure your PHP files perform no actions when accessed directly
Almost there! Just fix the following items
  • 107× PHP files trigger server-side errors or warnings when accessed directly (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'RichardMuvirimi\\WooCustomGateway\\Vendor\\GuzzleHttp\\Exception\\BadResponseException' not found in wp-content/plugins/woo-custom-gateway/vendor/woo-custom-gateway/psr-4/GuzzleHttp/Exception/ServerException.php:8
    • > PHP Fatal error
      Uncaught Error: Interface 'Stringable' not found in wp-content/plugins/woo-custom-gateway/vendor/woo-custom-gateway/psr-4/Symfony/Polyfill/Php80/PhpToken.php:19
    • > PHP Fatal error
      Uncaught Error: Interface 'RichardMuvirimi\\WooCustomGateway\\Vendor\\Br33f\\Ga4\\MeasurementProtocol\\Dto\\ExportableInterface' not found in wp-content/plugins/woo-custom-gateway/vendor/woo-custom-gateway/psr-4/Br33f/Ga4/MeasurementProtocol/Dto/Common/EventCollection.php:18
    • > PHP Fatal error
      Uncaught Error: Class 'RichardMuvirimi\\WooCustomGateway\\Vendor\\Br33f\\Ga4\\MeasurementProtocol\\Dto\\Response\\BaseResponse' not found in wp-content/plugins/woo-custom-gateway/vendor/woo-custom-gateway/psr-4/Br33f/Ga4/MeasurementProtocol/Dto/Response/DebugResponse.php:13
    • > PHP Fatal error
      Uncaught Error: Class 'RichardMuvirimi\\WooCustomGateway\\Vendor\\Br33f\\Ga4\\MeasurementProtocol\\Dto\\Parameter\\AbstractParameter' not found in wp-content/plugins/woo-custom-gateway/vendor/woo-custom-gateway/psr-4/Br33f/Ga4/MeasurementProtocol/Dto/Parameter/ItemCollectionParameter.php:16
    • > PHP Fatal error
      Uncaught Error: Interface 'RichardMuvirimi\\WooCustomGateway\\Vendor\\GuzzleHttp\\Promise\\PromiseInterface' not found in wp-content/plugins/woo-custom-gateway/vendor/woo-custom-gateway/psr-4/GuzzleHttp/Promise/Coroutine.php:46
    • > PHP Fatal error
      Uncaught Error: Class 'Random\\RandomError' not found in wp-content/plugins/woo-custom-gateway/vendor/woo-custom-gateway/classes/symfony/polyfill-php82/Resources/stubs/Random/BrokenRandomEngineError.php:15
    • > PHP Fatal error
      Uncaught Error: Class 'RichardMuvirimi\\WooCustomGateway\\Vendor\\GuzzleHttp\\Promise\\RejectionException' not found in wp-content/plugins/woo-custom-gateway/vendor/woo-custom-gateway/psr-4/GuzzleHttp/Promise/CancellationException.php:10
    • > PHP Fatal error
      Uncaught Error: Class 'RichardMuvirimi\\WooCustomGateway\\Vendor\\GuzzleHttp\\Cookie\\CookieJar' not found in wp-content/plugins/woo-custom-gateway/vendor/woo-custom-gateway/psr-4/GuzzleHttp/Cookie/FileCookieJar.php:10
    • > PHP Fatal error
      Uncaught Error: Interface 'RichardMuvirimi\\WooCustomGateway\\Vendor\\GuzzleHttp\\Promise\\PromisorInterface' not found in wp-content/plugins/woo-custom-gateway/vendor/woo-custom-gateway/psr-4/GuzzleHttp/Pool.php:24

User-side errors 0% from 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the browser (console and network errors and warnings)
Please fix the following user-side errors
    • > GET request to /wp-admin/admin.php?page=woo-custom-gateway
    • > Network (severe)
    wp-admin/admin.php?page=woo-custom-gateway - Failed to load resource: the server responded with a status of 500 (Internal Server Error)

Optimizations

Plugin configuration 93% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file describes your plugin functionality and requirements and it is parsed to prepare the your plugin's listing
These attributes need your attention:
  • Tags: Please reduce the number of tags, currently 12 tag instead of maximum 10
The official readme.txt is a good inspiration

woo-custom-gateway/woo-custom-gateway.php 92% from 13 tests

The main PHP script in "Woo Custom Gateway" version 1.6.1 is automatically included on every request by WordPress
Please make the necessary changes and fix the following:
  • Requires at least: Required version must be the same as the one declared in readme.txt ("4.0.0" instead of "3.0.0")

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
Success! There were no dangerous files found in this plugin15,190 lines of code in 247 files:
LanguageFilesBlank linesComment linesLines of code
PHP2253,1988,49513,576
JSON8001,368
Markdown8920178
JavaScript15024
XML26020
CSS25418
SVG1006

PHP code Passed 2 tests

Cyclomatic complexity and code structure are the fingerprint of this plugin
This plugin has no cyclomatic complexity issues
Cyclomatic complexity
Average complexity per logical line of code0.46
Average class complexity9.30
▷ Minimum class complexity1.00
▷ Maximum class complexity98.00
Average method complexity2.57
▷ Minimum method complexity1.00
▷ Maximum method complexity27.00
Code structure
Namespaces34
Interfaces36
Traits4
Classes161
▷ Abstract classes74.35%
▷ Concrete classes15495.65%
▷ Final classes5032.47%
Methods1,064
▷ Static methods18817.67%
▷ Public methods93387.69%
▷ Protected methods121.13%
▷ Private methods11911.18%
Functions121
▷ Named functions2823.14%
▷ Anonymous functions9376.86%
Constants106
▷ Global constants43.77%
▷ Class constants10296.23%
▷ Public constants9189.22%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
PNG images were not found in this plugin