73% woo-paypal-gateway

Code Review | Payment Gateway for PayPal on WooCommerce

WordPress plugin Payment Gateway for PayPal on WooCommerce scored 73% from 54 tests.

About plugin

  • Plugin page: woo-paypal-gateway
  • Plugin version: 7.1.8
  • PHP compatiblity: 7.0+
  • PHP version: 7.4.16
  • WordPress compatibility: 5.3-6.2.2
  • WordPress version: 6.3.1
  • First release: Dec 8, 2017
  • Latest release: May 25, 2023
  • Number of updates: 76
  • Update frequency: every 26.3 days
  • Top authors: easypayment (100%)

Code review

54 tests

User reviews

33 reviews

Install metrics

5,000+ active / 116,709 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | All plugins must install correctly, without throwing any errors, warnings, or notices
The plugin installed gracefully, with no errors

Server metrics [RAM: ▲0.04MB] [CPU: ▼3.72ms] Passed 4 tests

Analyzing server-side resources used by Payment Gateway for PayPal on WooCommerce
This plugin does not affect your website's performance
PageMemory (MB)CPU Time (ms)
Home /3.50 ▲0.0438.06 ▼5.63
Dashboard /wp-admin3.34 ▲0.0449.98 ▼0.99
Posts /wp-admin/edit.php3.39 ▲0.0447.70 ▼2.69
Add New Post /wp-admin/post-new.php5.94 ▲0.0692.67 ▼5.55
Media Library /wp-admin/upload.php3.26 ▲0.0434.31 ▼0.64

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

A short overview of filesystem and database impact
There were no storage issued detected upon installing this plugin
Filesystem: 785 new files
Database: no new tables, 6 new options
New WordPress options
widget_recent-posts
theysaidso_admin_options
widget_theysaidso_widget
db_upgraded
widget_recent-comments
can_compress_scripts

Browser metrics Passed 4 tests

Checking browser requirements for Payment Gateway for PayPal on WooCommerce
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,833 ▲8713.60 ▼0.991.54 ▼0.3437.71 ▼5.83
Dashboard /wp-admin2,239 ▲614.88 ▼0.05111.18 ▲6.1241.67 ▼7.26
Posts /wp-admin/edit.php2,125 ▲392.19 ▲0.1940.68 ▲5.1034.09 ▲2.73
Add New Post /wp-admin/post-new.php1,542 ▲1417.79 ▼5.33684.00 ▲19.4562.76 ▲6.25
Media Library /wp-admin/upload.php1,421 ▲364.29 ▲0.0898.65 ▼2.8745.18 ▼2.63

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
    • theysaidso_admin_options
    • can_compress_scripts
    • widget_recent-posts
    • widget_recent-comments
    • db_upgraded

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a short smoke test looking for server-side errors
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: PHP files have to remain inert when accessed directly, throwing no errors and performing no actions
Please take a closer look at the following
  • 379× GET requests to PHP files trigger server-side errors or Error 500 responses (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'PayPal\\Common\\PayPalResourceModel' not found in wp-content/plugins/woo-paypal-gateway/includes/php-library/paypal-rest/lib/PayPal/Api/Templates.php:24
    • > PHP Fatal error
      Uncaught Error: Class 'PayPal\\Common\\PayPalModel' not found in wp-content/plugins/woo-paypal-gateway/includes/php-library/paypal-rest/lib/PayPal/Api/Credit.php:17
    • > PHP Fatal error
      Uncaught Error: Class 'Braintree\\Base' not found in wp-content/plugins/woo-paypal-gateway/includes/php-library/braintree/lib/Braintree/OAuthAccessRevocation.php:11
    • > PHP Fatal error
      Uncaught Error: Class 'PayPal\\Common\\PayPalModel' not found in wp-content/plugins/woo-paypal-gateway/includes/php-library/paypal-rest/lib/PayPal/Api/Tax.php:21
    • > PHP Fatal error
      Uncaught Error: Class 'SebastianBergmann\\Comparator\\Comparator' not found in wp-content/plugins/woo-paypal-gateway/includes/php-library/paypal-rest/vendor/sebastian/comparator/src/TypeComparator.php:16
    • > PHP Fatal error
      Uncaught Error: Class 'WC_Payment_Gateway' not found in wp-content/plugins/woo-paypal-gateway/ppcp/includes/class-ppcp-paypal-checkout-for-woocommerce-request.php:9
    • > PHP Fatal error
      Uncaught Error: Class 'PayPal\\Api\\BankAccount' not found in wp-content/plugins/woo-paypal-gateway/includes/php-library/paypal-rest/lib/PayPal/Api/ExtendedBankAccount.php:13
    • > PHP Fatal error
      Uncaught Error: Class 'Braintree\\Base' not found in wp-content/plugins/woo-paypal-gateway/includes/php-library/braintree/lib/Braintree/CreditCard.php:45
    • > PHP Fatal error
      Uncaught Error: Class 'PayPal\\Common\\PayPalModel' not found in wp-content/plugins/woo-paypal-gateway/includes/php-library/paypal-rest/lib/PayPal/Api/Payee.php:17
    • > PHP Fatal error
      Uncaught Error: Class 'Braintree\\PartialMatchNode' not found in wp-content/plugins/woo-paypal-gateway/includes/php-library/braintree/lib/Braintree/TextNode.php:4

User-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no browser errors were triggered
Everything seems fine on the user side

Optimizations

Plugin configuration 93% from 29 tests

readme.txt 94% from 16 tests

Perhaps the most important file in your plugin readme.txt gets parsed in order to generate the public listing of your plugin
Attributes that need to be fixed:
  • Screenshots: No descriptions were found for these screenshots #1, #2, #3, #4, #5, #6, #7, #8 in woo-paypal-gateway/assets to your readme.txt
The official readme.txt is a good inspiration

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

Analyzing the main PHP file in "Payment Gateway for PayPal on WooCommerce" version 7.1.8
Please take the time to fix the following:
  • Requires at least: Required version must be the same as the one declared in readme.txt ("3.3" instead of "5.3")

Code Analysis 3% from 3 tests

File types 0% from 1 test

🔸 Test weight: 35 | Executable files are not allowed as they can serve as attack vectors
Almost there! Just fix the following issues
  • For security reasons, never distribute binary or executable files with your plugin
    • .crt - Security Certificate in Firefox, IE, Chrome, Safari
      • wp-content/plugins/woo-paypal-gateway/includes/php-library/braintree/lib/ssl/api_braintreegateway_com.ca.crt
    • .bat - Batch File in Windows
      • wp-content/plugins/woo-paypal-gateway/includes/php-library/paypal-rest/vendor/bin/phpunit.bat
59,096 lines of code in 731 files:
LanguageFilesBlank linesComment linesLines of code
PHP6278,56327,82750,675
YAML37164893,427
JSON16701,817
JavaScript11601,399
Markdown1743201,191
CSS470217
XML10121199
Ant6220147
Bourne Shell23120
DOS Batch1004

PHP code 50% from 2 tests

This is a very shot review of cyclomatic complexity and code structure
Please tend to the following items
  • Method cyclomatic complexity should be reduced to less than 100 (currently 110)
Cyclomatic complexity
Average complexity per logical line of code0.31
Average class complexity8.88
▷ Minimum class complexity1.00
▷ Maximum class complexity390.00
Average method complexity2.03
▷ Minimum method complexity1.00
▷ Maximum method complexity110.00
Code structure
Namespaces68
Interfaces26
Traits4
Classes578
▷ Abstract classes71.21%
▷ Concrete classes57198.79%
▷ Final classes122.10%
Methods4,649
▷ Static methods67714.56%
▷ Public methods4,27792.00%
▷ Protected methods1022.19%
▷ Private methods2705.81%
Functions95
▷ Named functions5760.00%
▷ Anonymous functions3840.00%
Constants883
▷ Global constants101.13%
▷ Class constants87398.87%
▷ Public constants873100.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
5 PNG files occupy 0.05MB with 0.02MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/images/wpg_paypal.png2.71KB1.96KB▼ 27.93%
assets/images/wpg_paypal-paypal-credit-card-logos.png19.75KB5.62KB▼ 71.56%
assets/images/wpg_cards.png8.09KB3.33KB▼ 58.77%
assets/images/wpg_paypal-credit-card-logos.png16.73KB5.74KB▼ 65.70%
assets/images/wpg_PP_credit_logo.png2.85KB2.02KB▼ 29.18%