77% shop-2-api

Code Review | Shop 2 API

WordPress plugin Shop 2 API scored77%from 54 tests.

About plugin

  • Plugin page: shop-2-api
  • Plugin version: 1.0.28.5
  • PHP compatiblity: 7.2+
  • PHP version: 7.4.16
  • WordPress compatibility: 5.0-6.3
  • WordPress version: 6.3.1
  • First release: Aug 1, 2021
  • Latest release: Nov 26, 2023
  • Number of updates: 49
  • Update frequency: every 17.3 days
  • Top authors: ascendedcrow (100%)

Code review

54 tests

User reviews

2 reviews

Install metrics

10+ active /1,438 total downloads

Benchmarks

Plugin footprint 82% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | All plugins must install correctly, without throwing any errors, warnings, or notices
This plugin's installer ran successfully

Server metrics [RAM: ▲0.49MB] [CPU: ▲902.70ms] 75% from 4 tests

An overview of server-side resources used by Shop 2 API
It is recommended to improve the following
  • Extra CPU: Extra CPU usage must be kept under 200.00ms (currently 902.70ms on /wp-admin/upload.php)
PageMemory (MB)CPU Time (ms)
Home /3.94 ▲0.4743.47 ▲2.64
Dashboard /wp-admin3.80 ▲0.491,218.24 ▲1,167.99
Posts /wp-admin/edit.php3.92 ▲0.551,349.20 ▲1,300.09
Add New Post /wp-admin/post-new.php6.41 ▲0.511,489.80 ▲1,390.83
Media Library /wp-admin/upload.php3.73 ▲0.491,170.53 ▲1,140.08

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

Filesystem and database footprint
There were no storage issued detected upon installing this plugin
Filesystem: 51 new files
Database: no new tables, 6 new options
New WordPress options
widget_recent-comments
can_compress_scripts
widget_theysaidso_widget
db_upgraded
theysaidso_admin_options
widget_recent-posts

Browser metrics Passed 4 tests

An overview of browser requirements for Shop 2 API
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,812 ▲5014.14 ▼0.571.77 ▲0.1343.58 ▼1.11
Dashboard /wp-admin2,214 ▲345.67 ▲0.0392.25 ▼0.5140.61 ▼3.92
Posts /wp-admin/edit.php2,127 ▲272.03 ▲0.0138.79 ▼2.9134.83 ▼0.07
Add New Post /wp-admin/post-new.php1,546 ▲2022.87 ▼0.37668.08 ▲7.0155.23 ▲5.93
Media Library /wp-admin/upload.php1,425 ▲284.20 ▼0.01101.75 ▲1.3244.08 ▲0.69

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
The following items require your attention
  • This plugin does not fully uninstall, leaving 6 options in the database
    • db_upgraded
    • theysaidso_admin_options
    • widget_theysaidso_widget
    • can_compress_scripts
    • widget_recent-comments
    • widget_recent-posts

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a short smoke test looking for server-side errors
Even though everything seems fine, this is not 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
Please fix the following
  • 3× PHP files output non-empty strings when accessed directly via GET requests:
    • > /wp-content/plugins/shop-2-api/templates/connection-information.php
    • > /wp-content/plugins/shop-2-api/shop-2-api.php
    • > /wp-content/plugins/shop-2-api/templates/wc-category-mapping.php
  • 31× GET requests to PHP files trigger server-side errors or Error 500 responses (only 10 are shown):
    • > PHP Fatal error
      require_once(): Failed opening required 'SHOP2API_PLUGIN_PATH/includes/Base/CommonFunctions.php' (include_path='.:/usr/share/php') in wp-content/plugins/shop-2-api/includes/Tables/Bol2WcStatusReport.php on line 12
    • > PHP Warning
      Use of undefined constant SHOP2API_PLUGIN_PATH - assumed 'SHOP2API_PLUGIN_PATH' (this will throw an Error in a future version of PHP) in wp-content/plugins/shop-2-api/includes/Tables/Bol2WcOrderReport.php on line 12
    • > PHP Warning
      require_once(SHOP2API_PLUGIN_PATH/includes/Base/CommonFunctions.php): failed to open stream: No such file or directory in wp-content/plugins/shop-2-api/templates/common-header.php on line 2
    • > PHP Warning
      Use of undefined constant SHOP2API_PLUGIN_PATH - assumed 'SHOP2API_PLUGIN_PATH' (this will throw an Error in a future version of PHP) in wp-content/plugins/shop-2-api/templates/common-header.php on line 2
    • > PHP Warning
      require_once(SHOP2API_PLUGIN_PATH/includes/Api/Shop2ApiConnect.php): failed to open stream: No such file or directory in wp-content/plugins/shop-2-api/includes/Tables/WcCategorySelection.php on line 12
    • > PHP Warning
      Use of undefined constant SHOP2API_PLUGIN_PATH - assumed 'SHOP2API_PLUGIN_PATH' (this will throw an Error in a future version of PHP) in wp-content/plugins/shop-2-api/includes/Tables/Bol2WcStatusReportDetail.php on line 12
    • > PHP Warning
      require_once(SHOP2API_PLUGIN_PATH/includes/Base/CommonFunctions.php): failed to open stream: No such file or directory in wp-content/plugins/shop-2-api/templates/common-header.php on line 2
    • > PHP Warning
      Use of undefined constant SHOP2API_PLUGIN_PATH - assumed 'SHOP2API_PLUGIN_PATH' (this will throw an Error in a future version of PHP) in wp-content/plugins/shop-2-api/templates/common-header.php on line 2
    • > PHP Fatal error
      require_once(): Failed opening required 'SHOP2API_PLUGIN_PATH/includes/Base/CommonFunctions.php' (include_path='.:/usr/share/php') in wp-content/plugins/shop-2-api/templates/common-header.php on line 2
    • > PHP Warning
      require_once(SHOP2API_PLUGIN_PATH/includes/Base/CommonFunctions.php): failed to open stream: No such file or directory in wp-content/plugins/shop-2-api/templates/common-header.php on line 2

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

readme.txt 94% from 16 tests

The readme.txt file describes your plugin functionality and requirements and it is parsed to prepare the your plugin's listing
These attributes need your attention:
  • Contributors: The plugin contributors field is not present
The official readme.txt is a good inspiration

shop-2-api/shop-2-api.php 85% from 13 tests

The main file in "Shop 2 API" v. 1.0.28.5 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:
  • Text Domain: The text domain follows the same naming rules as the plugin slug: lowercase characters and dashes
  • Description: Please don't use more than 140 characters for the plugin description (currently 286 characters long)

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | There should be no dangerous file extensions present in any WordPress plugin
Everything looks great! No dangerous files found in this plugin4,907 lines of code in 44 files:
LanguageFilesBlank linesComment linesLines of code
PHP294623763,097
JavaScript12247961,331
CSS39530479

PHP code Passed 2 tests

This is a short overview of cyclomatic complexity and code structure for this plugin
This plugin has no cyclomatic complexity problems
Cyclomatic complexity
Average complexity per logical line of code0.18
Average class complexity11.12
▷ Minimum class complexity1.00
▷ Maximum class complexity36.00
Average method complexity1.97
▷ Minimum method complexity1.00
▷ Maximum method complexity15.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes17
▷ Abstract classes00.00%
▷ Concrete classes17100.00%
▷ Final classes15.88%
Methods175
▷ Static methods74.00%
▷ Public methods16192.00%
▷ Protected methods00.00%
▷ Private methods148.00%
Functions1
▷ Named functions00.00%
▷ Anonymous functions1100.00%
Constants4
▷ Global constants4100.00%
▷ Class constants00.00%
▷ Public constants00.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
6 PNG files occupy 0.36MB with 0.22MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/bol-icon.png56.84KB19.21KB▼ 66.21%
assets/logo.png113.31KB44.68KB▼ 60.57%
assets/CredentialsBol.png152.22KB56.77KB▼ 62.71%
assets/woocommerce-icon.png18.48KB7.25KB▼ 60.78%
assets/external/png/pictures.png14.70KB6.22KB▼ 57.70%