93% onepay-for-woocommerce

Code Review | Onepay para WooCommerce

WordPress plugin Onepay para WooCommerce scored 93% from 54 tests.

About plugin

  • Plugin page: onepay-for-woocom...
  • Plugin version: 1.0.0
  • PHP compatiblity: 7.0+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.8-5.7.1
  • WordPress version: 5.8.1
  • First release: May 7, 2021
  • Latest release: Sep 13, 2021
  • Number of updates: 5
  • Update frequency: every 26.0 days
  • Top authors: 1paypagamentos (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active / 154 total downloads

Benchmarks

Plugin footprint Passed 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
The plugin installed successfully, without throwing any errors or notices

Server metrics [RAM: ▲0.01MB] [CPU: ▼150.02ms] Passed 4 tests

A check of server-side resources used by Onepay para WooCommerce
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /2.86 ▲0.1423.45 ▲3.86
Dashboard /wp-admin3.15 ▲0.0932.56 ▼14.94
Posts /wp-admin/edit.php3.20 ▲0.1034.69 ▼10.06
Add New Post /wp-admin/post-new.php5.16 ▼0.2776.40 ▼565.93
Media Library /wp-admin/upload.php3.15 ▲0.1429.63 ▼9.14

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

Input-output and database impact of this plugin
No storage issues were detected
Filesystem: 81 new files
Database: no new tables, no new options

Browser metrics Passed 4 tests

An overview of browser requirements for Onepay para WooCommerce
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,345 ▼26115.72 ▲0.200.41 ▼7.5910.40 ▼32.95
Dashboard /wp-admin3,063 ▲1326.19 ▲0.21141.04 ▼8.64105.93 ▼4.52
Posts /wp-admin/edit.php2,835 ▲962.83 ▲0.1474.32 ▲7.3195.09 ▲6.30
Add New Post /wp-admin/post-new.php1,678 ▼521.47 ▲2.73282.29 ▼80.93105.27 ▼0.77
Media Library /wp-admin/upload.php1,901 ▲945.04 ▲0.01144.37 ▼16.05116.63 ▼3.68

Uninstaller [IO: ▲0.00MB] [DB: ▲0.00MB] Passed 4 tests

🔸 Tests weight: 35 | It is important to correctly uninstall your plugin, without leaving any traces
Uninstaller ran successfully

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the server (in the Apache logs)
Even though everything seems fine, this is not an exhaustive test

SRP 50% from 2 tests

🔹 Tests weight: 20 | A shallow check of the single-responsibility principle; PHP files should perform no action - including output of placeholder text - and trigger no errors when accessed directly
Please take a closer look at the following
  • 7× PHP files trigger server-side errors or warnings when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Class 'OnePay\\SDK\\Requests\\AbstractRequest' not found in wp-content/plugins/onepay-for-woocommerce/vendor/OnePay/SDK/Requests/Estabelecimento/GetWebhookRequest.php:7
    • > PHP Fatal error
      Uncaught Error: Call to undefined function delete_option() in wp-content/plugins/onepay-for-woocommerce/uninstall.php:3
    • > PHP Fatal error
      Uncaught Error: Class 'OnePay\\SDK\\Requests\\AbstractRequest' not found in wp-content/plugins/onepay-for-woocommerce/vendor/OnePay/SDK/Requests/Pagamento/PagamentoRequest.php:7
    • > PHP Fatal error
      Uncaught Error: Class 'OnePay\\SDK\\Requests\\AbstractRequest' not found in wp-content/plugins/onepay-for-woocommerce/vendor/OnePay/SDK/Requests/Pagamento/StatusRequest.php:7
    • > PHP Fatal error
      Uncaught Error: Class 'OnePay\\SDK\\Requests\\AbstractRequest' not found in wp-content/plugins/onepay-for-woocommerce/vendor/OnePay/SDK/Requests/Pagamento/RefundRequest.php:7
    • > PHP Fatal error
      Uncaught Error: Class 'OnePay\\SDK\\Requests\\AbstractRequest' not found in wp-content/plugins/onepay-for-woocommerce/vendor/OnePay/SDK/Requests/Estabelecimento/AddWebhookRequest.php:7
    • > PHP Fatal error
      Uncaught Error: Interface 'OnePay\\SDK\\Requests\\InterfaceRequest' not found in wp-content/plugins/onepay-for-woocommerce/vendor/OnePay/SDK/Requests/AbstractRequest.php:13

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for browser errors
There were no browser issues found

Optimizations

Plugin configuration 90% from 29 tests

readme.txt 94% from 16 tests

Often overlooked, readme.txt is one of the most important files in your plugin
Attributes that require attention: The official readme.txt might help

onepay-for-woocommerce/wc-onepay.php 85% from 13 tests

"Onepay para WooCommerce" version 1.0.0's main PHP file describes plugin functionality and also serves as the entry point to any WordPress functionality
The following require your attention:
  • Text Domain: Since WordPress version 4.6 the text domain is optional; if specified, it must be the same as the plugin slug
  • Main file name: Even though not officially enforced, the main plugin file should be the same as the plugin slug ("onepay-for-woocommerce.php" instead of "wc-onepay.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | Executable files are considered dangerous and should not be included with any WordPress plugin
There were no executable files found in this plugin4,420 lines of code in 65 files:
LanguageFilesBlank linesComment linesLines of code
PHP539991,6463,425
JavaScript813790655
PO File1118166328
CSS21411
JSON1001

PHP code Passed 2 tests

Analyzing logical lines of code, cyclomatic complexity, and other code metrics
This plugin has no cyclomatic complexity problems
Cyclomatic complexity
Average complexity per logical line of code0.28
Average class complexity9.11
▷ Minimum class complexity1.00
▷ Maximum class complexity44.00
Average method complexity2.00
▷ Minimum method complexity1.00
▷ Maximum method complexity33.00
Code structure
Namespaces5
Interfaces1
Traits3
Classes32
▷ Abstract classes26.25%
▷ Concrete classes3093.75%
▷ Final classes13.33%
Methods294
▷ Static methods3010.20%
▷ Public methods28195.58%
▷ Protected methods72.38%
▷ Private methods62.04%
Functions14
▷ Named functions1392.86%
▷ Anonymous functions17.14%
Constants21
▷ Global constants838.10%
▷ Class constants1361.90%
▷ Public constants13100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

It is recommended to compress PNG files in your plugin to minimize bandwidth usage
2 PNG files occupy 0.01MB with 0.00MB in potential savings
Potential savings
Compression of 2 random PNG files using pngquant
FileSize - originalSize - compressedSavings
includes/gateway/methods/creditcard/assets/public/img/logo_horizontal_min.png3.44KB2.09KB▼ 39.17%
includes/gateway/methods/boleto/assets/public/img/logo_horizontal_min.png3.44KB2.09KB▼ 39.17%