79% svea-webpay-for-woocommerce

Code Review | Svea WebPay for WooCommerce

WordPress plugin Svea WebPay for WooCommerce scored79%from 54 tests.

About plugin

  • Plugin page: svea-webpay-for-w...
  • Plugin version: 3.1.1
  • PHP compatiblity: 7.0+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.9-6.2.2
  • WordPress version: 6.3.1
  • First release: Aug 20, 2020
  • Latest release: Oct 20, 2023
  • Number of updates: 12
  • Update frequency: every 96.4 days
  • Top authors: thegeneration (100%)

Code review

54 tests

User reviews

1 review

Install metrics

40+ active /5,368 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
Install script ran successfully

Server metrics [RAM: ▲0.00MB] [CPU: ▼9.79ms] Passed 4 tests

Server-side resources used by Svea WebPay for WooCommerce
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /3.46 ▲0.0040.15 ▼2.82
Dashboard /wp-admin3.31 ▲0.0045.44 ▼7.37
Posts /wp-admin/edit.php3.36 ▲0.0042.21 ▼11.81
Add New Post /wp-admin/post-new.php5.89 ▲0.0077.51 ▼17.16
Media Library /wp-admin/upload.php3.23 ▲0.0034.40 ▲0.68

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

Analyzing filesystem and database footprints of this plugin
This plugin installed successfully
Filesystem: 618 new files
Database: no new tables, 7 new options
New WordPress options
widget_recent-comments
theysaidso_admin_options
can_compress_scripts
widget_theysaidso_widget
db_upgraded
sveawebpay_deferred_admin_notices
widget_recent-posts

Browser metrics Passed 4 tests

A check of browser resources used by Svea WebPay for WooCommerce
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,814 ▲5314.35 ▼0.282.04 ▲0.2541.72 ▼1.19
Dashboard /wp-admin2,195 ▲215.63 ▲0.0194.70 ▼3.8342.13 ▲0.90
Posts /wp-admin/edit.php2,100 ▼01.99 ▼0.0232.93 ▼4.3434.56 ▼1.52
Add New Post /wp-admin/post-new.php1,526 ▼1223.09 ▼0.08623.34 ▲41.5350.32 ▲5.53
Media Library /wp-admin/upload.php1,400 ▲34.22 ▲0.03103.64 ▲6.3144.28 ▲1.69

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
You still need to fix the following
  • This plugin did not uninstall successfully, leaving 7 options in the database
    • sveawebpay_deferred_admin_notices
    • widget_recent-comments
    • theysaidso_admin_options
    • widget_recent-posts
    • widget_theysaidso_widget
    • db_upgraded
    • can_compress_scripts

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for server-side errors
Good news, no errors were detected

SRP 0% 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 fix the following items
  • 14× GET requests to PHP files return non-empty strings (only 10 are shown):
    • > /wp-content/plugins/svea-webpay-for-woocommerce/vendor/sveaekonomi/checkout/examples/admin/update-order-row.php
    • > /wp-content/plugins/svea-webpay-for-woocommerce/vendor/sveaekonomi/checkout/examples/get-available-part-payment-campaigns.php
    • > /wp-content/plugins/svea-webpay-for-woocommerce/vendor/sveaekonomi/checkout/examples/admin/credit-order-amount.php
    • > /wp-content/plugins/svea-webpay-for-woocommerce/vendor/sveaekonomi/checkout/examples/admin/get-task.php
    • > /wp-content/plugins/svea-webpay-for-woocommerce/vendor/sveaekonomi/checkout/examples/admin/add-order-row.php
    • > /wp-content/plugins/svea-webpay-for-woocommerce/vendor/sveaekonomi/checkout/examples/admin/cancel-order-amount.php
    • > /wp-content/plugins/svea-webpay-for-woocommerce/vendor/sveaekonomi/checkout/examples/get-order.php
    • > /wp-content/plugins/svea-webpay-for-woocommerce/vendor/sveaekonomi/checkout/examples/admin/credit-new-order-row.php
    • > /wp-content/plugins/svea-webpay-for-woocommerce/vendor/sveaekonomi/checkout/examples/admin/credit-order-rows.php
    • > /wp-content/plugins/svea-webpay-for-woocommerce/vendor/sveaekonomi/checkout/examples/admin/cancel-order-row.php
  • 405× GET requests to PHP files have triggered server-side errors or warnings (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'PHPUnit\\Framework\\TestCase' not found in wp-content/plugins/svea-webpay-for-woocommerce/vendor/sveaekonomi/webpay/test/UnitTest/BuildOrder/Validator/HostedOrderValidatorTest.php:13
    • > PHP Fatal error
      Uncaught Error: Class 'Svea\\WebPay\\Test\\UnitTest\\Checkout\\TestCase' not found in wp-content/plugins/svea-webpay-for-woocommerce/vendor/sveaekonomi/webpay/test/UnitTest/Checkout/Model/CheckoutPresetValueTest.php:12
    • > PHP Fatal error
      Uncaught Error: Interface 'Svea\\WebPay\\Helper\\PaymentPlanHelper\\CampaignTypeCalculator\\IPaymentPlanCalculator' not found in wp-content/plugins/svea-webpay-for-woocommerce/vendor/sveaekonomi/webpay/src/Helper/PaymentPlanHelper/CampaignTypeCalculator/InterestAndAmortizationFreePaymentPlanCalculator.php:8
    • > PHP Fatal error
      Uncaught Error: Class 'Svea\\WebPay\\Config\\ConfigurationProvider' not found in wp-content/plugins/svea-webpay-for-woocommerce/vendor/sveaekonomi/webpay/src/Config/config_prod.php:27
    • > PHP Fatal error
      Uncaught Error: Class 'PHPUnit\\Framework\\TestCase' not found in wp-content/plugins/svea-webpay-for-woocommerce/vendor/sveaekonomi/webpay/test/IntegrationTest/WebService/GetAddresses/GetAddressesIntegrationTest.php:14
    • > PHP Fatal error
      Uncaught Error: Class 'Svea\\WebPay\\HostedService\\Payment\\HostedPayment' not found in wp-content/plugins/svea-webpay-for-woocommerce/vendor/sveaekonomi/webpay/src/HostedService/Payment/DirectPayment.php:17
    • > PHP Fatal error
      require_once(): Failed opening required '../../vendor/autoload.php' (include_path='.:/usr/share/php') in wp-content/plugins/svea-webpay-for-woocommerce/vendor/sveaekonomi/webpay/example/swishorder/swishorder.php on line 8
    • > PHP Fatal error
      Uncaught Error: Class 'PHPUnit\\Framework\\TestCase' not found in wp-content/plugins/svea-webpay-for-woocommerce/vendor/sveaekonomi/webpay/test/IntegrationTest/WebPayAdminIntegrationTest.php:17
    • > PHP Fatal error
      Uncaught Error: Class 'Svea\\WebPay\\HostedService\\HostedRequest' not found in wp-content/plugins/svea-webpay-for-woocommerce/vendor/sveaekonomi/webpay/src/HostedService/HostedAdminRequest/CreditTransaction.php:16
    • > PHP Fatal error
      Uncaught Error: Class 'PHPUnit\\Framework\\TestCase' not found in wp-content/plugins/svea-webpay-for-woocommerce/vendor/sveaekonomi/webpay/test/IntegrationTest/AdminService/UpdateOrderRequestIntegrationTest.php:16

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
No browser errors were detected

Optimizations

Plugin configuration Passed 29 tests

readme.txt Passed 16 tests

Often overlooked, readme.txt is one of the most important files in your plugin
8 plugin tags: woocommerce, svea ekonomi, direct bank, checkout, invoice...

svea-webpay-for-woocommerce/svea-webpay-for-woocommerce.php Passed 13 tests

The principal PHP file in "Svea WebPay for WooCommerce" v. 3.1.1 is loaded by WordPress automatically on each request
140 characters long description:
Supercharge your WooCommerce Store with powerful features to pay via Svea Ekonomi Creditcard, Direct Bank Payment, Invoice and Part Payment.

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
No dangerous file extensions were detected71,269 lines of code in 568 files:
LanguageFilesBlank linesComment linesLines of code
PHP53510,99518,71452,244
SVG10411,295
Markdown285603,364
PO File31,2572,2942,506
JavaScript618825689
Sass611128632
JSON400374
XML417887
YAML315465
CSS41813

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.15
Average class complexity6.74
▷ Minimum class complexity1.00
▷ Maximum class complexity335.00
Average method complexity1.83
▷ Minimum method complexity1.00
▷ Maximum method complexity89.00
Code structure
Namespaces92
Interfaces5
Traits0
Classes455
▷ Abstract classes153.30%
▷ Concrete classes44096.70%
▷ Final classes10.23%
Methods3,041
▷ Static methods1986.51%
▷ Public methods2,69688.66%
▷ Protected methods1514.97%
▷ Private methods1946.38%
Functions37
▷ Named functions2567.57%
▷ Anonymous functions1232.43%
Constants157
▷ Global constants31.91%
▷ Class constants15498.09%
▷ Public constants154100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

All PNG images should be compressed to minimize bandwidth usage for end users
13 PNG files occupy 0.18MB with 0.12MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/img/direktbank.png14.37KB5.45KB▼ 62.11%
assets/img/logo_paypal.png2.57KB1.11KB▼ 56.60%
assets/img/kort.png10.74KB4.12KB▼ 61.67%
assets/img/visa-mastercard.png28.48KB9.96KB▼ 65.04%
assets/img/cross.png5.11KB1.39KB▼ 72.88%