73% wc-paymentsds-mpesa

Code Review | PaymentsDS - Mpesa Payment Gateway for WooCommerce

WordPress plugin PaymentsDS - Mpesa Payment Gateway for WooCommerce scored73%from 54 tests.

About plugin

  • Plugin page: wc-paymentsds-mpesa
  • Plugin version: 1.0.1
  • PHP compatiblity: 7.0+
  • PHP version: 7.4.16
  • WordPress compatibility: 5.0-5.9
  • WordPress version: 6.3.1
  • First release: Jul 8, 2021
  • Latest release: Mar 30, 2022
  • Number of updates: 8
  • Update frequency: every 33.3 days
  • Top authors: ltsaiete (100%)

Code review

54 tests

User reviews

1 review

Install metrics

20+ active /3,118 total downloads

Benchmarks

Plugin footprint 65% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | All plugins must install correctly, without throwing any errors, warnings, or notices
This plugin's installer ran successfully

Server metrics [RAM: ▲0.32MB] [CPU: ▼1.35ms] Passed 4 tests

An overview of server-side resources used by PaymentsDS - Mpesa Payment Gateway for WooCommerce
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /3.94 ▲0.4840.79 ▼3.50
Dashboard /wp-admin3.64 ▲0.3448.95 ▲1.65
Posts /wp-admin/edit.php3.69 ▲0.3350.18 ▲0.59
Add New Post /wp-admin/post-new.php6.16 ▲0.2787.76 ▼4.14
Media Library /wp-admin/upload.php3.56 ▲0.3338.07 ▲5.73

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

Filesystem and database footprint
This plugin was installed successfully
Filesystem: 16 new files
Database: 1 new table, 6 new options
New tables
wp_mpesa_wp_transactions
New WordPress options
theysaidso_admin_options
db_upgraded
widget_recent-comments
widget_theysaidso_widget
can_compress_scripts
widget_recent-posts

Browser metrics Passed 4 tests

PaymentsDS - Mpesa Payment Gateway for WooCommerce: an overview of browser usage
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,800 ▲5413.21 ▼1.171.63 ▼1.1743.27 ▼2.79
Dashboard /wp-admin2,209 ▲214.82 ▼1.06108.37 ▼3.2838.49 ▼3.18
Posts /wp-admin/edit.php2,092 ▼02.00 ▼0.0139.29 ▲3.4736.41 ▲4.54
Add New Post /wp-admin/post-new.php1,542 ▲923.22 ▲0.10640.96 ▲34.9249.43 ▼1.86
Media Library /wp-admin/upload.php1,388 ▼04.17 ▼0.03100.89 ▼1.4343.45 ▼2.90

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

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
You still need to fix the following
  • Zombie tables were found after uninstall: 1 table
    • wp_mpesa_wp_transactions
  • This plugin does not fully uninstall, leaving 6 options in the database
    • theysaidso_admin_options
    • widget_recent-comments
    • widget_recent-posts
    • db_upgraded
    • can_compress_scripts
    • widget_theysaidso_widget

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no server-side errors were triggered
Even though everything seems fine, this is not an exhaustive test

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
Please fix the following items
  • 50× PHP files trigger server-side errors or warnings when accessed directly (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'GuzzleHttp\\Psr7\\Request' not found in wp-content/plugins/wc-paymentsds-mpesa/vendor/guzzlehttp/psr7/src/ServerRequest.php:27
    • > PHP Fatal error
      Uncaught Error: Interface 'Psr\\Http\\Message\\StreamInterface' not found in wp-content/plugins/wc-paymentsds-mpesa/vendor/guzzlehttp/psr7/src/CachingStream.php:13
    • > PHP Fatal error
      Uncaught Error: Class 'GuzzleHttp\\Cookie\\CookieJar' not found in wp-content/plugins/wc-paymentsds-mpesa/vendor/guzzlehttp/guzzle/src/Cookie/FileCookieJar.php:10
    • > PHP Fatal error
      Uncaught Error: Interface 'Psr\\Http\\Message\\StreamInterface' not found in wp-content/plugins/wc-paymentsds-mpesa/vendor/guzzlehttp/psr7/src/LazyOpenStream.php:13
    • > PHP Fatal error
      Uncaught Error: Interface 'Psr\\Http\\Client\\ClientExceptionInterface' not found in wp-content/plugins/wc-paymentsds-mpesa/vendor/guzzlehttp/guzzle/src/Exception/GuzzleException.php:7
    • > PHP Fatal error
      Uncaught Error: Interface 'GuzzleHttp\\Promise\\PromiseInterface' not found in wp-content/plugins/wc-paymentsds-mpesa/vendor/guzzlehttp/promises/src/Coroutine.php:45
    • > PHP Fatal error
      Uncaught Error: Interface 'Psr\\Http\\Client\\ClientExceptionInterface' not found in wp-content/plugins/wc-paymentsds-mpesa/vendor/psr/http-client/src/NetworkExceptionInterface.php:14
    • > PHP Fatal error
      Uncaught Error: Interface 'Psr\\Http\\Message\\StreamInterface' not found in wp-content/plugins/wc-paymentsds-mpesa/vendor/guzzlehttp/psr7/src/BufferStream.php:17
    • > PHP Fatal error
      Uncaught Error: Interface 'GuzzleHttp\\Promise\\TaskQueueInterface' not found in wp-content/plugins/wc-paymentsds-mpesa/vendor/guzzlehttp/promises/src/TaskQueue.php:14
    • > PHP Fatal error
      Uncaught Error: Interface 'Psr\\Http\\Message\\ResponseInterface' not found in wp-content/plugins/wc-paymentsds-mpesa/vendor/guzzlehttp/psr7/src/Response.php:13

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for browser errors
There were no browser issues found

Optimizations

Plugin configuration 90% from 29 tests

readme.txt 94% from 16 tests

Often overlooked, readme.txt is one of the most important files in your plugin
These attributes need to be fixed:
  • Tags: Please delete some tags, you are using 12 tag instead of maximum 10
The official readme.txt is a good inspiration

wc-paymentsds-mpesa/mpesa-wp-plugin.php 85% from 13 tests

The main file in "PaymentsDS - Mpesa Payment Gateway for WooCommerce" v. 1.0.1 serves as a complement to information provided in readme.txt and as the entry point to the plugin
You should first fix the following items:
  • Main file name: Name the main plugin file the same as the plugin slug ("wc-paymentsds-mpesa.php" instead of "mpesa-wp-plugin.php")
  • Text Domain: If you choose to specify the text domain, it must be the same as the plugin slug; optional since WordPress version 4.6

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | This is an overview of file extensions present in this plugin and a short test that no dangerous files are bundled with this plugin
Everything looks great! No dangerous files found in this plugin21,883 lines of code in 168 files:
LanguageFilesBlank linesComment linesLines of code
PHP1322,1615,6409,932
JSON15008,022
Markdown151,23103,712
PO File1394793
CSS115661
JavaScript23047
make1409
YAML1007

PHP code Passed 2 tests

This plugin's cyclomatic complexity and code structure detailed below
All good! No complexity issues found
Cyclomatic complexity
Average complexity per logical line of code0.44
Average class complexity11.97
▷ Minimum class complexity1.00
▷ Maximum class complexity88.00
Average method complexity2.72
▷ Minimum method complexity1.00
▷ Maximum method complexity25.00
Code structure
Namespaces13
Interfaces26
Traits3
Classes92
▷ Abstract classes00.00%
▷ Concrete classes92100.00%
▷ Final classes3436.96%
Methods792
▷ Static methods14017.68%
▷ Public methods66784.22%
▷ Protected methods40.51%
▷ Private methods12115.28%
Functions129
▷ Named functions3829.46%
▷ Anonymous functions9170.54%
Constants118
▷ Global constants10.85%
▷ Class constants11799.15%
▷ Public constants10690.60%

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.00MB with 0.00MB in potential savings
Potential savings
Compression of 1 random PNG file using pngquant
FileSize - originalSize - compressedSavings
assets/mpesa-logo.png3.55KB2.08KB▼ 41.47%