10% svea-checkout-for-woocommerce

Code Review | Svea Checkout for WooCommerce

WordPress plugin Svea Checkout for WooCommerce scored10%from 54 tests.

About plugin

  • Plugin page: svea-checkout-for...
  • Plugin version: 2.5.2
  • PHP compatiblity: 8.0+
  • PHP version: 7.4.16
  • WordPress compatibility: 5.0.0-6.3.1
  • WordPress version: 6.3.1
  • First release: Jun 25, 2018
  • Latest release: Oct 26, 2023
  • Number of updates: 77
  • Update frequency: every 25.4 days
  • Top authors: thegeneration (100%)

Code review

54 tests

User reviews

1 review

Install metrics

700+ active /18,363 total downloads

Benchmarks

Plugin footprint 58% from 16 tests

Installer 0% from 1 test

🔺 Critical test (weight: 50) | The install procedure must perform silently
You still need to fix the following installer errors
  • Install procedure had errors
    • > Deprecated in wp-content/plugins/svea-checkout-for-woocommerce/inc/Webhook_Handler.php+155
    The behavior of unparenthesized expressions containing both '.' and '+'/'-' will change in PHP 8: '+'/'-' will take a higher precedence

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

This is a short check of server-side resources used by Svea Checkout for WooCommerce
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /3.46 ▲0.0038.11 ▼0.37
Dashboard /wp-admin3.31 ▲0.0046.34 ▼1.47
Posts /wp-admin/edit.php3.36 ▲0.0040.81 ▼5.85
Add New Post /wp-admin/post-new.php5.89 ▲0.0079.31 ▼24.02
Media Library /wp-admin/upload.php3.23 ▲0.0034.83 ▲2.30

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

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

Browser metrics Passed 4 tests

This is an overview of browser requirements for Svea Checkout for WooCommerce
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,789 ▲2814.35 ▲0.011.81 ▲0.1045.87 ▲2.51
Dashboard /wp-admin2,192 ▲155.55 ▼0.0782.74 ▼5.2439.39 ▼2.18
Posts /wp-admin/edit.php2,100 ▼02.01 ▲0.0634.67 ▼0.6035.96 ▲4.62
Add New Post /wp-admin/post-new.php1,526 ▼023.04 ▼0.01671.75 ▼0.5152.89 ▼9.18
Media Library /wp-admin/upload.php1,400 ▼04.15 ▼0.0793.19 ▼1.4844.45 ▲1.02

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

🔸 Tests weight: 35 | The uninstall procedure must remove all plugin files and extra database tables
It is recommended to fix the following
  • This plugin does not fully uninstall, leaving 7 options in the database
    • widget_theysaidso_widget
    • db_upgraded
    • svea_checkout_admin_notices
    • theysaidso_admin_options
    • widget_recent-comments
    • widget_recent-posts
    • 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
Even though no errors were found, this is by no means an exhaustive test

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
Almost there! Just fix the following items
  • 15× GET requests to PHP files return non-empty strings (only 10 are shown):
    • > /wp-content/plugins/svea-checkout-for-woocommerce/templates/backend/log-metabox.php
    • > /wp-content/plugins/svea-checkout-for-woocommerce/vendor/sveaekonomi/checkout/examples/admin/get-order.php
    • > /wp-content/plugins/svea-checkout-for-woocommerce/vendor/sveaekonomi/checkout/examples/admin/update-order-row.php
    • > /wp-content/plugins/svea-checkout-for-woocommerce/vendor/sveaekonomi/checkout/examples/create-order.php
    • > /wp-content/plugins/svea-checkout-for-woocommerce/vendor/sveaekonomi/checkout/examples/admin/cancel-order.php
    • > /wp-content/plugins/svea-checkout-for-woocommerce/vendor/sveaekonomi/checkout/examples/admin/get-task.php
    • > /wp-content/plugins/svea-checkout-for-woocommerce/vendor/sveaekonomi/checkout/examples/admin/cancel-order-amount.php
    • > /wp-content/plugins/svea-checkout-for-woocommerce/vendor/sveaekonomi/checkout/examples/admin/credit-new-order-row.php
    • > /wp-content/plugins/svea-checkout-for-woocommerce/vendor/sveaekonomi/checkout/examples/admin/credit-order-amount.php
    • > /wp-content/plugins/svea-checkout-for-woocommerce/vendor/sveaekonomi/checkout/examples/get-available-part-payment-campaigns.php
  • 85× GET requests to PHP files have triggered server-side errors or warnings (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'Svea\\Checkout\\Tests\\Unit\\TestCase' not found in wp-content/plugins/svea-checkout-for-woocommerce/vendor/sveaekonomi/checkout/tests/Unit/Validation/Admin/ValidateGetTaskDataTest.php:8
    • > PHP Fatal error
      Uncaught Error: Class 'Svea\\Checkout\\Implementation\\Admin\\AdminImplementationManager' not found in wp-content/plugins/svea-checkout-for-woocommerce/vendor/sveaekonomi/checkout/src/Implementation/Admin/GetTask.php:7
    • > PHP Warning
      include(): Failed opening 'wp-content/plugins/svea-checkout-for-woocommerce/vendor/sveaekonomi/checkout/vendor/autoload.php' for inclusion (include_path='.:/usr/share/php') in wp-content/plugins/svea-checkout-for-woocommerce/vendor/sveaekonomi/checkout/tests/bootstrap.php on line 3
    • > PHP Fatal error
      Uncaught Error: Class 'Svea\\Checkout\\Tests\\Unit\\TestCase' not found in wp-content/plugins/svea-checkout-for-woocommerce/vendor/sveaekonomi/checkout/tests/Unit/Validation/Admin/ValidateCancelOrderDataTest.php:8
    • > PHP Fatal error
      Uncaught Error: Class 'Svea\\Checkout\\Implementation\\Admin\\AdminImplementationManager' not found in wp-content/plugins/svea-checkout-for-woocommerce/vendor/sveaekonomi/checkout/src/Implementation/Admin/AddOrderRow.php:7
    • > PHP Fatal error
      Uncaught Error: Class 'PHPUnit_Framework_TestCase' not found in wp-content/plugins/svea-checkout-for-woocommerce/vendor/sveaekonomi/checkout/tests/Unit/TestCase.php:10
    • > PHP Fatal error
      Uncaught Error: Class 'Svea\\Checkout\\Tests\\Unit\\TestCase' not found in wp-content/plugins/svea-checkout-for-woocommerce/vendor/sveaekonomi/checkout/tests/Unit/Validation/Admin/ValidateUpdateOrderRowDataTest.php:8
    • > PHP Fatal error
      Uncaught Error: Class 'Svea\\Checkout\\Implementation\\ImplementationManager' not found in wp-content/plugins/svea-checkout-for-woocommerce/vendor/sveaekonomi/checkout/src/Implementation/GetTokenOrder.php:9
    • > PHP Fatal error
      Uncaught Error: Class 'Svea\\Checkout\\Implementation\\Admin\\AdminImplementationManager' not found in wp-content/plugins/svea-checkout-for-woocommerce/vendor/sveaekonomi/checkout/src/Implementation/Admin/CancelOrder.php:9
    • > PHP Fatal error
      Uncaught Error: Class 'Svea\\Checkout\\Tests\\Unit\\TestCase' not found in wp-content/plugins/svea-checkout-for-woocommerce/vendor/sveaekonomi/checkout/tests/Unit/Implementation/Admin/GetTaskTest.php:10

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for browser errors
Everything seems fine, but this is not an exhaustive test

Optimizations

Plugin configuration 90% from 29 tests

readme.txt Passed 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
9 plugin tags: svea ekonomi, part payment, invoice, credit card, svea checkout...

svea-checkout-for-woocommerce/svea-checkout-for-woocommerce.php 77% from 13 tests

The main file in "Svea Checkout for WooCommerce" v. 2.5.2 serves as a complement to information provided in readme.txt and as the entry point to the plugin
Please take the time to fix the following:
  • Domain Path: Note that the domain path follows the same naming rules as the domain name, using only dashes and lowercase characters ("languages")
  • Domain Path: The domain path must begin with a forward slash character ("/languages")
  • Requires at least: Required version does not match the one declared in readme.txt ("4.9" instead of "5.0.0")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | Executable files are not allowed as they can serve as attack vectors
No dangerous file extensions were detected12,646 lines of code in 173 files:
LanguageFilesBlank linesComment linesLines of code
PHP1592,8395,53810,759
Markdown237701,193
PO File1201265488
JSON200100
XML315878
YAML14223
CSS3003
JavaScript2002

PHP code Passed 2 tests

This is a short overview of cyclomatic complexity and code structure for this plugin
Although this was not an exhaustive test, there were no cyclomatic complexity issues detected
Cyclomatic complexity
Average complexity per logical line of code0.23
Average class complexity7.38
▷ Minimum class complexity1.00
▷ Maximum class complexity146.00
Average method complexity1.94
▷ Minimum method complexity1.00
▷ Maximum method complexity37.00
Code structure
Namespaces23
Interfaces2
Traits0
Classes122
▷ Abstract classes32.46%
▷ Concrete classes11997.54%
▷ Final classes10.84%
Methods842
▷ Static methods9110.81%
▷ Public methods79093.82%
▷ Protected methods111.31%
▷ Private methods414.87%
Functions33
▷ Named functions1751.52%
▷ Anonymous functions1648.48%
Constants32
▷ Global constants26.25%
▷ Class constants3093.75%
▷ Public constants2790.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
1 PNG file occupies 0.02MB with 0.01MB in potential savings
Potential savings
Compression of 1 random PNG file using pngquant
FileSize - originalSize - compressedSavings
vendor/sveaekonomi/checkout/docs/image/flow.png16.25KB7.42KB▼ 54.34%