67% bananacrystal-payment-gateway

Code Review | BananaCrystal Payment Gateway

WordPress plugin BananaCrystal Payment Gateway scored 67% from 54 tests.

About plugin

  • Plugin page: bananacrystal-pay...
  • Plugin version: 1.2.5
  • PHP version: 7.4.16
  • WordPress compatibility: 5.0-6.3
  • WordPress version: 6.3.1
  • First release: Jan 30, 2023
  • Latest release: Aug 31, 2023
  • Number of updates: 10
  • Update frequency: every 21.6 days
  • Top authors: bananacrystal (100%)

Code review

54 tests

User reviews

8 reviews

Install metrics

10+ active / 233 total downloads

Benchmarks

Plugin footprint 65% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | It is important to correctly install your plugin, without throwing errors or notices
Installer ran successfully

Server metrics [RAM: ▲0.02MB] [CPU: ▼0.67ms] Passed 4 tests

An overview of server-side resources used by BananaCrystal Payment Gateway
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /3.48 ▲0.0238.81 ▼2.06
Dashboard /wp-admin3.32 ▲0.0247.99 ▼0.38
Posts /wp-admin/edit.php3.37 ▲0.0249.56 ▲0.20
Add New Post /wp-admin/post-new.php5.90 ▲0.0294.13 ▼0.45
Media Library /wp-admin/upload.php3.25 ▲0.0236.81 ▲1.81
Add Subscription Plan /wp-admin/admin.php?page=add-bc-subscription-plans3.2737.45
Subscriptions/Transactions /wp-admin/admin.php?page=bc-subscriptions3.2534.61
Manage Subscription Plans /wp-admin/admin.php?page=bc-subscription-plans3.2532.49

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

Input-output and database impact of this plugin
The plugin installed successfully
Filesystem: 29 new files
Database: 2 new tables, 6 new options
New tables
wp_banana_crystal_subscriptions
wp_banana_crystal_subscription_plans
New WordPress options
db_upgraded
widget_theysaidso_widget
widget_recent-comments
widget_recent-posts
theysaidso_admin_options
can_compress_scripts

Browser metrics Passed 4 tests

This is an overview of browser requirements for BananaCrystal Payment Gateway
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,935 ▲20013.50 ▼1.258.03 ▲6.2138.33 ▼5.74
Dashboard /wp-admin2,233 ▲454.84 ▼0.03110.66 ▲9.3439.51 ▼4.41
Posts /wp-admin/edit.php2,119 ▲301.99 ▼0.0639.87 ▼0.1336.49 ▲0.12
Add New Post /wp-admin/post-new.php1,564 ▲3118.32 ▼4.92616.92 ▼63.9259.18 ▲5.48
Media Library /wp-admin/upload.php1,412 ▲244.19 ▲0.0198.72 ▲2.3844.55 ▲1.13
Add Subscription Plan /wp-admin/admin.php?page=add-bc-subscription-plans1,5876.53140.8761.98
Subscriptions/Transactions /wp-admin/admin.php?page=bc-subscriptions8192.0324.0725.13
Manage Subscription Plans /wp-admin/admin.php?page=bc-subscription-plans8222.0626.0527.63

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

🔸 Tests weight: 35 | All plugins must uninstall correctly, removing their source code and extra database tables they might have created
Please fix the following items
  • The uninstall procedure failed, leaving 2 tables in the database
    • wp_banana_crystal_subscriptions
    • wp_banana_crystal_subscription_plans
  • Zombie WordPress options detected upon uninstall: 6 options
    • theysaidso_admin_options
    • widget_recent-comments
    • db_upgraded
    • widget_theysaidso_widget
    • can_compress_scripts
    • widget_recent-posts

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
Good news, no errors were detected

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
  • 1× PHP files perform the task of outputting text when accessed with GET requests:
    • > /wp-content/plugins/bananacrystal-payment-gateway/public/partials/woocommerce-gateway-banana-crystal-public-display.php
  • 9× GET requests to PHP files trigger server-side errors or Error 500 responses:
    • > PHP Notice
      Trying to get property 'prefix' of non-object in wp-content/plugins/bananacrystal-payment-gateway/admin/views/subscription_plans_front.php on line 59
    • > PHP Fatal error
      Uncaught Error: Call to a member function get_results() on null in wp-content/plugins/bananacrystal-payment-gateway/admin/views/subscription_plans_front.php:60
    • > PHP Fatal error
      Uncaught Error: Call to a member function get_results() on null in wp-content/plugins/bananacrystal-payment-gateway/admin/views/subscriptions_view.php:22
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/bananacrystal-payment-gateway/cron.php:3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function self_admin_url() in wp-content/plugins/bananacrystal-payment-gateway/admin/views/subscription_plans_view.php:3
    • > PHP Notice
      Trying to get property 'prefix' of non-object in wp-content/plugins/bananacrystal-payment-gateway/admin/views/subscriptions_view.php on line 21
    • > PHP Fatal error
      Uncaught Error: Class 'WC_Payment_Gateway' not found in wp-content/plugins/bananacrystal-payment-gateway/includes/class-banana-crystal-woocommerce.php:3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function wp_editor() in wp-content/plugins/bananacrystal-payment-gateway/admin/views/add_subscription_plan_view.php:34
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_current_user_id() in wp-content/plugins/bananacrystal-payment-gateway/admin/views/current_subscription_front.php:58

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for browser errors
Everything seems fine on the user side

Optimizations

Plugin configuration 86% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file is an important file in your plugin as it is parsed by WordPress.org to prepare the public listing of your plugin
These attributes need your attention:
  • Plugin Name: You should set the name of your plugin on the first line ( === bananacrystal-payment-gateway === )
Please take inspiration from this readme.txt

bananacrystal-payment-gateway/woocommerce-gateway-banana-crystal.php 77% from 13 tests

The main PHP script in "BananaCrystal Payment Gateway" version 1.2.5 is automatically included on every request by WordPress
Please make the necessary changes and fix the following:
  • Description: The description should be shorter than 140 characters (currently 203 characters long)
  • Main file name: Even though not officially enforced, the main plugin file should be the same as the plugin slug ("bananacrystal-payment-gateway.php" instead of "woocommerce-gateway-banana-crystal.php")
  • Text Domain: The text domain must be the same as the plugin slug, although 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 plugin1,076 lines of code in 22 files:
LanguageFilesBlank linesComment linesLines of code
PHP202326321,068
CSS1145
JavaScript12273

PHP code Passed 2 tests

A short review of cyclomatic complexity and code structure
Everything seems fine, there were no complexity issues found
Cyclomatic complexity
Average complexity per logical line of code0.22
Average class complexity4.33
▷ Minimum class complexity1.00
▷ Maximum class complexity15.00
Average method complexity1.64
▷ Minimum method complexity1.00
▷ Maximum method complexity4.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes9
▷ Abstract classes00.00%
▷ Concrete classes9100.00%
▷ Final classes00.00%
Methods47
▷ Static methods24.26%
▷ Public methods4289.36%
▷ Protected methods00.00%
▷ Private methods510.64%
Functions12
▷ Named functions12100.00%
▷ Anonymous functions00.00%
Constants1
▷ Global constants1100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

All PNG images should be compressed to minimize bandwidth usage for end users
2 PNG files occupy 0.01MB with 0.01MB in potential savings
Potential savings
Compression of 2 random PNG files using pngquant
FileSize - originalSize - compressedSavings
public/img/bananacrystal-logo.png10.50KB5.46KB▼ 48.01%
public/img/bananacrystal-logo-square.png3.63KB2.25KB▼ 38.00%