10% dation-woocommerce

Code Review | Dation Woocommerce

WordPress plugin Dation Woocommerce scored10%from 54 tests.

About plugin

  • Plugin page: dation-woocommerce
  • Plugin version: 1.2.46
  • PHP compatiblity: 7.2+
  • PHP version: 7.4.16
  • WordPress compatibility: 5.2-5.2
  • WordPress version: 6.3.1
  • First release: Dec 9, 2019
  • Latest release: Sep 22, 2022
  • Number of updates: 54
  • Update frequency: every 21.9 days
  • Top authors: jvanhengeldationnl (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /1,262 total downloads

Benchmarks

Plugin footprint 40% from 16 tests

Installer 0% from 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
These installer errors require your attention
  • Install procedure had errors
    • > Notice in wp-content/plugins/dation-woocommerce/includes/Adapter/RestApiClientFactory.php+33
    Trying to access array offset on value of type null

Server metrics [RAM: ▼1.63MB] [CPU: ▼51.86ms] Passed 4 tests

This is a short check of server-side resources used by Dation Woocommerce
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /2.37 ▼1.109.65 ▼32.23
Dashboard /wp-admin2.39 ▼0.9611.12 ▼51.88
Posts /wp-admin/edit.php2.39 ▼0.979.38 ▼37.95
Add New Post /wp-admin/post-new.php2.39 ▼3.5010.55 ▼85.38
Media Library /wp-admin/upload.php2.39 ▼0.8510.38 ▼19.38
Instellingen /wp-admin/admin.php?page=dation2.3910.22
Cursussen /wp-admin/admin.php?page=dation-cursussen2.3912.58

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

Input-output and database impact of this plugin
No storage issues were detected
Filesystem: 595 new files
Database: no new tables, 7 new options
New WordPress options
can_compress_scripts
widget_recent-comments
widget_recent-posts
recovery_mode_email_last_sent
widget_theysaidso_widget
theysaidso_admin_options
db_upgraded

Browser metrics Passed 4 tests

This is an overview of browser requirements for Dation Woocommerce
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,836 ▲7514.28 ▼0.082.02 ▲0.3447.01 ▲7.71
Dashboard /wp-admin2,220 ▲465.58 ▼0.0082.13 ▼2.1867.14 ▲25.94
Posts /wp-admin/edit.php2,128 ▲281.97 ▲0.0038.08 ▲0.6732.43 ▼3.53
Add New Post /wp-admin/post-new.php1,544 ▲1822.50 ▼0.74730.02 ▲110.1657.53 ▲3.20
Media Library /wp-admin/upload.php1,422 ▲194.30 ▲0.0895.45 ▲1.4772.61 ▲33.18
Instellingen /wp-admin/admin.php?page=dation1,0232.1822.9932.65
Cursussen /wp-admin/admin.php?page=dation-cursussen7031.516.9319.53

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

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
It is recommended to fix the following
  • Uninstall procedure had uncaught errors
    • > Notice in wp-content/plugins/dation-woocommerce/includes/Adapter/RestApiClientFactory.php+33
    Trying to access array offset on value of type bool
  • The uninstall procedure has failed, leaving 7 options in the database
    • theysaidso_admin_options
    • recovery_mode_email_last_sent
    • db_upgraded
    • widget_recent-posts
    • widget_theysaidso_widget
    • widget_recent-comments
    • can_compress_scripts

Smoke tests 50% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | A shallow check that no server-side errors were triggered
These server-side errors were triggered
  • 6 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=dation-cursussen
    • > Notice in wp-content/plugins/dation-woocommerce/includes/Adapter/RestApiClientFactory.php+33
    Trying to access array offset on value of type bool
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=dation-cursussen
    • > User deprecated in wp-content/plugins/dation-woocommerce/vendor/symfony/serializer/Normalizer/DateTimeNormalizer.php+47
    Passing configuration options directly to the constructor is deprecated since Symfony 4.2, use the default context instead.
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=dation-cursussen
    • > User deprecated in wp-content/plugins/dation-woocommerce/vendor/symfony/serializer/Encoder/JsonEncode.php+35
    Passing an integer as first parameter of the "Symfony\Component\Serializer\Encoder\JsonEncode::__construct()" method is deprecated since Symfony 4.2, use the "json_encode_options" key of the context instead.
    • > GET request to /wp-admin/admin.php?page=dation-cursussen
    • > Error in wp-content/plugins/dation-woocommerce/includes/Admin/ProductList.php+58
    Uncaught Error: Class 'WC_Product_Query' not found in wp-content/plugins/dation-woocommerce/includes/Admin/ProductList.php:58
    Stack trace:
    #0 wp-content/plugins/dation-woocommerce/includes/Admin/ProductList.php(18): Dation\Woocommerce\Admin\ProductList->table_data()
    #1 wp-content/plugins/dation-woocommerce/admin/dw-courses.php(14): Dation\Woocommerce\Admin\ProductList->prepare_items()
    #2 wp-includes/class-wp-hook.php(310): dw_render_course_page()
    #3 wp-includes/class-wp-hook.php(334): WP_Hook->apply_filters()
    #4 wp-includes/plugin.php(517): WP_Hook->do_action()
    #5 wp-admin/admin.php(259): do_action()
    #6 {main}
    thrown

SRP 50% 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 take a closer look at the following
  • 233× GET requests to PHP files trigger server-side errors or Error 500 responses (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'phpDocumentor\\Reflection\\Types\\AggregatedType' not found in wp-content/plugins/dation-woocommerce/vendor/phpdocumentor/type-resolver/src/PseudoTypes/Numeric_.php:28
    • > PHP Fatal error
      Uncaught Error: Class 'phpDocumentor\\Reflection\\Types\\String_' not found in wp-content/plugins/dation-woocommerce/vendor/phpdocumentor/type-resolver/src/PseudoTypes/LiteralString.php:25
    • > PHP Fatal error
      Uncaught Error: Class 'phpDocumentor\\Reflection\\Types\\Integer' not found in wp-content/plugins/dation-woocommerce/vendor/phpdocumentor/type-resolver/src/PseudoTypes/PositiveInteger.php:25
    • > PHP Fatal error
      Uncaught Error: Interface 'Stringable' not found in wp-content/plugins/dation-woocommerce/vendor/symfony/string/LazyString.php:19
    • > PHP Fatal error
      Uncaught Error: Interface 'Symfony\\Component\\Serializer\\Encoder\\EncoderInterface' not found in wp-content/plugins/dation-woocommerce/vendor/symfony/serializer/Encoder/JsonEncode.php:21
    • > PHP Fatal error
      Uncaught Error: Interface 'Symfony\\Component\\PropertyAccess\\Exception\\ExceptionInterface' not found in wp-content/plugins/dation-woocommerce/vendor/symfony/property-access/Exception/InvalidArgumentException.php:19
    • > PHP Fatal error
      Uncaught Error: Class 'SetBased\\Exception\\Test\\FormattedExceptionTestBase' not found in wp-content/plugins/dation-woocommerce/vendor/setbased/exception/test/LogicFormattedExceptionTest.php:11
    • > PHP Fatal error
      Uncaught Error: Class 'Symfony\\Component\\Serializer\\Exception\\RuntimeException' not found in wp-content/plugins/dation-woocommerce/vendor/symfony/serializer/Exception/ExtraAttributesException.php:19
    • > PHP Fatal error
      Uncaught Error: Class 'phpDocumentor\\Reflection\\Types\\AggregatedType' not found in wp-content/plugins/dation-woocommerce/vendor/phpdocumentor/type-resolver/src/Types/ArrayKey.php:26
    • > PHP Fatal error
      Uncaught Error: Interface 'phpDocumentor\\Reflection\\Type' not found in wp-content/plugins/dation-woocommerce/vendor/phpdocumentor/type-resolver/src/Types/Boolean.php:23

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
There were no browser issues found

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
No tags were detected

dation-woocommerce/dation-woocommerce.php Passed 13 tests

This is the main PHP file of "Dation Woocommerce" version 1.2.46, providing information about the plugin in the header fields and serving as the principal entry point to the plugin's functions
109 characters long description:
Je website altijd up-to-date met je Dation planning. Importeer je Dation cursussen als Woocommerce producten.

Code Analysis 97% from 3 tests

File types Passed 1 test

🔸 Test weight: 35 | This is a short overview of programming languages used in this plugin, detecting executable files
Success! There were no dangerous files found in this plugin84,486 lines of code in 558 files:
LanguageFilesBlank linesComment linesLines of code
PHP4427,55318,88452,870
JSON280021,281
JavaScript261,9642,5134,980
Markdown371,50404,509
YAML11633373
Sass6194288
XSD111072
XML20032
CSS14030
HTML12018
Ant13314
Dockerfile18010
make1409

PHP code 50% from 2 tests

Analyzing logical lines of code, cyclomatic complexity, and other code metrics
Please tend to the following items
  • Method cyclomatic complexity should be reduced to less than 100 (currently 179)
Cyclomatic complexity
Average complexity per logical line of code0.55
Average class complexity13.57
▷ Minimum class complexity1.00
▷ Maximum class complexity367.00
Average method complexity3.16
▷ Minimum method complexity1.00
▷ Maximum method complexity179.00
Code structure
Namespaces62
Interfaces70
Traits9
Classes304
▷ Abstract classes92.96%
▷ Concrete classes29597.04%
▷ Final classes9732.88%
Methods2,325
▷ Static methods67328.95%
▷ Public methods1,97184.77%
▷ Protected methods451.94%
▷ Private methods30913.29%
Functions347
▷ Named functions22965.99%
▷ Anonymous functions11834.01%
Constants416
▷ Global constants9422.60%
▷ Class constants32277.40%
▷ Public constants26883.23%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
1 compressed PNG file occupies 0.00MB
Potential savings
Compression of 1 random PNG file using pngquant
FileSize - originalSize - compressedSavings
admin/images/dation-elephant-head-20x20.png0.57KB0.67KB0.00%