84% campay-api

Code Review | Campay Woocommerce Payment Gateway

WordPress plugin Campay Woocommerce Payment Gateway scored84%from 54 tests.

About plugin

  • Plugin page: campay-api
  • Plugin version: 1.1.6
  • PHP compatiblity: 7.0+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.9-6.2
  • WordPress version: 6.3.1
  • First release: Mar 27, 2021
  • Latest release: Nov 16, 2023
  • Number of updates: 154
  • Update frequency: every 6.3 days
  • Top authors: campay (100%)

Code review

54 tests

User reviews

1 review

Install metrics

100+ active /5,457 total downloads

Benchmarks

Plugin footprint 83% 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.09MB] [CPU: ▼6.82ms] Passed 4 tests

Analyzing server-side resources used by Campay Woocommerce Payment Gateway
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /3.55 ▲0.0942.00 ▼0.44
Dashboard /wp-admin3.39 ▲0.0946.55 ▲2.96
Posts /wp-admin/edit.php3.44 ▲0.0943.80 ▼7.37
Add New Post /wp-admin/post-new.php5.97 ▲0.0980.66 ▼18.45
Media Library /wp-admin/upload.php3.31 ▲0.0932.95 ▼1.01

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

Filesystem and database footprint
The plugin installed successfully
Filesystem: 14 new files
Database: no new tables, 6 new options
New WordPress options
theysaidso_admin_options
can_compress_scripts
widget_recent-posts
widget_recent-comments
db_upgraded
widget_theysaidso_widget

Browser metrics Passed 4 tests

Campay Woocommerce Payment Gateway: an overview of browser usage
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,790 ▲2814.70 ▲0.431.78 ▲0.0543.87 ▼0.41
Dashboard /wp-admin2,195 ▲155.61 ▼0.0286.07 ▼2.9240.34 ▼3.55
Posts /wp-admin/edit.php2,100 ▼32.14 ▲0.1438.73 ▼7.2633.15 ▼5.68
Add New Post /wp-admin/post-new.php1,528 ▲223.17 ▼0.14674.92 ▲59.8560.06 ▲7.43
Media Library /wp-admin/upload.php1,397 ▼64.22 ▲0.04101.28 ▼4.2144.18 ▼0.68

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

🔸 Tests weight: 35 | The uninstall procedure must remove all plugin files and extra database tables
You still need to fix the following
  • Zombie WordPress options detected upon uninstall: 6 options
    • widget_theysaidso_widget
    • can_compress_scripts
    • widget_recent-posts
    • theysaidso_admin_options
    • db_upgraded
    • widget_recent-comments

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the server (in the Apache logs)
Everything seems fine, however this is by no means an exhaustive test

SRP 50% 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 take a closer look at the following
  • 4× PHP files trigger server errors when accessed directly:
    • > PHP Warning
      Use of undefined constant ABSPATH - assumed 'ABSPATH' (this will throw an Error in a future version of PHP) in wp-content/plugins/campay-api/campay-api.php on line 18
    • > PHP Fatal error
      Uncaught Error: Call to undefined function apply_filters() in wp-content/plugins/campay-api/campay-api.php:19
    • > PHP Warning
      include_once(ABSPATHwp-admin/includes/plugin.php): failed to open stream: No such file or directory in wp-content/plugins/campay-api/campay-api.php on line 18
    • > PHP Warning
      include_once(): Failed opening 'ABSPATHwp-admin/includes/plugin.php' for inclusion (include_path='.:/usr/share/php') in wp-content/plugins/campay-api/campay-api.php on line 18

User-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no browser errors were triggered
There were no browser issues found

Optimizations

Plugin configuration 93% from 29 tests

readme.txt 88% from 16 tests

The readme.txt file is important because it is parsed by WordPress.org for the public listing of your plugin
These attributes need your attention:
  • Contributors: Plugin contributors field is missing
  • Screenshots: These screenshots lack descriptions #1, #2 in campay-api/assets to your readme.txt
The official readme.txt is a good inspiration

campay-api/campay-api.php Passed 13 tests

The main PHP script in "Campay Woocommerce Payment Gateway" version 1.1.6 is automatically included on every request by WordPress
54 characters long description:
Accept Mobile Money Payment using CamPay API Services.

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short check of programming languages and file extensions; no executable files are allowed
Everything looks great! No dangerous files found in this plugin942 lines of code in 6 files:
LanguageFilesBlank linesComment linesLines of code
PHP114685542
PO File38080225
CSS1106136
JavaScript1221339

PHP code Passed 2 tests

This is a short overview of cyclomatic complexity and code structure for this plugin
Everything seems fine, there were no complexity issues found
Cyclomatic complexity
Average complexity per logical line of code0.34
Average class complexity59.00
▷ Minimum class complexity59.00
▷ Maximum class complexity59.00
Average method complexity4.62
▷ Minimum method complexity1.00
▷ Maximum method complexity24.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes1
▷ Abstract classes00.00%
▷ Concrete classes1100.00%
▷ Final classes00.00%
Methods16
▷ Static methods00.00%
▷ Public methods16100.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions3
▷ Named functions3100.00%
▷ Anonymous functions00.00%
Constants0
▷ Global constants00.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Using a strong compression for your PNG files is a great way to speed-up your plugin
2 PNG files occupy 0.01MB with 0.00MB in potential savings
Potential savings
Compression of 2 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/img/momo-om.png2.79KB1.74KB▼ 37.87%
assets/img/logo-campay-momo.png6.27KB2.68KB▼ 57.30%