83% woocommerce-paypal-here-gateway

Code Review | WooCommerce PayPal Here Payment Gateway

WordPress plugin WooCommerce PayPal Here Payment Gateway scored 83% from 54 tests.

About plugin

  • Plugin page: woocommerce-paypa...
  • Plugin version: 1.1.3
  • PHP compatiblity: 5.3+
  • PHP version: 7.4.16
  • WordPress compatibility: 3.0.0-5.7
  • WordPress version: 5.8.1
  • First release: Dec 10, 2018
  • Latest release: Apr 2, 2021
  • Number of updates: 15
  • Update frequency: every 56.9 days
  • Top authors: SkyVerge (80%)automattic (26.67%)

Code review

54 tests

User reviews

1 review

Install metrics

800+ active / 8,158 total downloads

Benchmarks

Plugin footprint Passed 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
The plugin installed gracefully, with no errors

Server metrics [RAM: ▲0.03MB] [CPU: ▼150.72ms] Passed 4 tests

Analyzing server-side resources used by WooCommerce PayPal Here Payment Gateway
This plugin does not affect your website's performance
PageMemory (MB)CPU Time (ms)
Home /2.87 ▲0.0340.75 ▼5.18
Dashboard /wp-admin3.09 ▲0.0451.41 ▼8.28
Posts /wp-admin/edit.php3.14 ▲0.0453.88 ▼15.53
Add New Post /wp-admin/post-new.php5.45 ▲0.02107.47 ▼573.87
Media Library /wp-admin/upload.php3.03 ▲0.0343.34 ▲2.79

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

Analyzing filesystem and database footprints of this plugin
No storage issues were detected
Filesystem: 604 new files
Database: no new tables, no new options

Browser metrics Passed 4 tests

This is an overview of browser requirements for WooCommerce PayPal Here Payment Gateway
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,721 ▲14915.60 ▼0.049.48 ▼3.2150.26 ▼0.79
Dashboard /wp-admin2,991 ▲576.01 ▼0.03154.89 ▼31.57118.16 ▼10.37
Posts /wp-admin/edit.php2,759 ▲202.73 ▲0.0173.96 ▼10.6294.96 ▼0.09
Add New Post /wp-admin/post-new.php1,694 ▲11318.42 ▲0.92462.98 ▲33.80125.54 ▲2.06
Media Library /wp-admin/upload.php1,825 ▲185.04 ▼0.01174.00 ▼0.08130.61 ▲3.21

Uninstaller [IO: ▲0.00MB] [DB: ▲0.00MB] Passed 4 tests

🔸 Tests weight: 35 | The uninstall procedure must remove all plugin files and extra database tables
This plugin's uninstaller ran successfully

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)
The smoke test was a success, however most plugin functionality was not tested

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
  • 15× PHP files trigger errors when accessed directly with GET requests (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_html() in wp-content/plugins/woocommerce-paypal-here-gateway/vendor/skyverge/wc-plugin-framework/woocommerce/payment-gateway/admin/views/html-user-payment-token-editor.php:28
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_attr() in wp-content/plugins/woocommerce-paypal-here-gateway/vendor/skyverge/wc-plugin-framework/woocommerce/payment-gateway/admin/views/html-order-partial-capture.php:26
    • > PHP Fatal error
      Uncaught Error: Class 'SkyVerge\\WooCommerce\\PluginFramework\\v5_6_1\\Payment_Gateway\\Handlers\\Abstract_Payment_Handler' not found in wp-content/plugins/woocommerce-paypal-here-gateway/vendor/skyverge/wc-plugin-framework/woocommerce/payment-gateway/Handlers/Abstract_Hosted_Payment_Handler.php:39
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_attr() in wp-content/plugins/woocommerce-paypal-here-gateway/vendor/skyverge/wc-plugin-framework/woocommerce/payment-gateway/admin/views/html-user-profile-field-customer-id.php:27
    • > PHP Fatal error
      Uncaught Error: Class 'QRcode' not found in wp-content/plugins/woocommerce-paypal-here-gateway/vendor/pendalff/phpqrcode/index.php:67
    • > PHP Notice
      Undefined variable: fields in wp-content/plugins/woocommerce-paypal-here-gateway/vendor/skyverge/wc-plugin-framework/woocommerce/payment-gateway/admin/views/html-user-payment-token-editor-token.php on line 30
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_attr() in wp-content/plugins/woocommerce-paypal-here-gateway/vendor/skyverge/wc-plugin-framework/woocommerce/payment-gateway/admin/views/html-user-profile-section.php:26
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_attr() in wp-content/plugins/woocommerce-paypal-here-gateway/includes/Admin/Meta_Boxes/Views/html-order-data.php:31
    • > PHP Notice
      Trying to access array offset on value of type null in wp-content/plugins/woocommerce-paypal-here-gateway/vendor/skyverge/wc-plugin-framework/woocommerce/payment-gateway/admin/views/html-user-payment-token-editor-token.php on line 28
    • > PHP Notice
      Undefined variable: index in wp-content/plugins/woocommerce-paypal-here-gateway/vendor/skyverge/wc-plugin-framework/woocommerce/payment-gateway/admin/views/html-user-payment-token-editor-token.php on line 26

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 86% from 29 tests

readme.txt 94% from 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
These attributes need to be fixed:
  • Tags: Please reduce the number of tags, currently 15 tag instead of maximum 10
The official readme.txt might help

woocommerce-paypal-here-gateway/woocommerce-gateway-paypal-here.php 77% from 13 tests

The main PHP script in "WooCommerce PayPal Here Payment Gateway" version 1.1.3 is automatically included on every request by WordPress
You should first fix the following items:
  • Main file name: It is recommended to name the main PHP file as the plugin slug ("woocommerce-paypal-here-gateway.php" instead of "woocommerce-gateway-paypal-here.php")
  • Text Domain: The text domain is optional since WordPress version 4.6; if you do specify it, it must be the same as the plugin slug
  • Requires at least: Required version must be the same as the one declared in readme.txt ("4.4" instead of "3.0.0")

Code Analysis 5% from 3 tests

File types 0% from 1 test

🔸 Test weight: 35 | An overview of files in this plugin; executable files are not allowed
Almost there! Just fix the following issues
  • Even if your plugin relies on executable files (for example a companion app), never distribute executable files with your plugin
    • .bat - Batch File in Windows
      • wp-content/plugins/woocommerce-paypal-here-gateway/vendor/pendalff/phpqrcode/tools/merge.bat
21,312 lines of code in 167 files:
LanguageFilesBlank linesComment linesLines of code
PHP12310,00618,61220,042
PO File14087191,049
CSS7190112
JSON10072
SVG210021
JavaScript120012
Bourne Shell1002
DOS Batch1002

PHP code Passed 2 tests

Analyzing cyclomatic complexity and code structure
There are no cyclomatic complexity problems detected for this plugin
Cyclomatic complexity
Average complexity per logical line of code0.38
Average class complexity25.66
▷ Minimum class complexity1.00
▷ Maximum class complexity292.00
Average method complexity2.85
▷ Minimum method complexity1.00
▷ Maximum method complexity26.00
Code structure
Namespaces13
Interfaces13
Traits0
Classes110
▷ Abstract classes1917.27%
▷ Concrete classes9182.73%
▷ Final classes00.00%
Methods1,718
▷ Static methods27215.83%
▷ Public methods1,22271.13%
▷ Protected methods47527.65%
▷ Private methods211.22%
Functions8
▷ Named functions562.50%
▷ Anonymous functions337.50%
Constants162
▷ Global constants9961.11%
▷ Class constants6338.89%
▷ Public constants63100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

All PNG images should be compressed to minimize bandwidth usage for end users
62 compressed PNG files occupy 0.04MB
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
vendor/skyverge/wc-plugin-framework/woocommerce/payment-gateway/assets/images/card-dinersclub.png1.36KB1.42KB0.00%
vendor/skyverge/wc-plugin-framework/woocommerce/payment-gateway/assets/images/card-cc-invalid.png3.67KB2.08KB▼ 43.22%
vendor/pendalff/phpqrcode/cache/frame_17.png0.21KB0.19KB▼ 6.64%
vendor/pendalff/phpqrcode/cache/frame_37.png0.27KB0.25KB▼ 7.89%
vendor/pendalff/phpqrcode/cache/frame_13.png0.21KB0.19KB▼ 5.24%