10% openpay-payment-gateway

Code Review | Openpay Payment Gateway

WordPress plugin Openpay Payment Gateway scored10%from 54 tests.

About plugin

  • Plugin page: openpay-payment-g...
  • Plugin version: 1.2.3
  • PHP compatiblity: 5.6+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.5-6.1
  • WordPress version: 6.3.1
  • First release: Aug 7, 2022
  • Latest release: Nov 22, 2022
  • Number of updates: 20
  • Update frequency: every 5.5 days
  • Top authors: opyintegrations (100%)

Code review

54 tests

User reviews

1 review

Install metrics

20+ active /919 total downloads

Benchmarks

Plugin footprint 58% from 16 tests

Installer 0% from 1 test

🔺 Critical test (weight: 50) | The install procedure must perform silently
The following installer errors require your attention
  • The plugin did not install without errors
    • > Error in wp-content/plugins/openpay-payment-gateway/class/WC_Gateway_Openpay.php+5
    Uncaught Error: Class 'WC_Payment_Gateway' not found in wp-content/plugins/openpay-payment-gateway/class/WC_Gateway_Openpay.php:5
    Stack trace:
    #0 wp-content/plugins/openpay-payment-gateway/class/Cron/Openpay_Plugin_Cron.php(6): require_once()
    #1 wp-content/plugins/openpay-payment-gateway/openpay.php(75): require_once('/var/www/wordpr...')
    #2 wp-content/plugins/openpay-payment-gateway/openpay.php(98): Openpay_Payment::load_classes()
    #3 wp-content/plugins/openpay-payment-gateway/openpay.php(83): Openpay_Payment::init()
    #4 wp-includes/class-wp-hook.php(310): Openpay_Payment::activate_plugin()
    #5 wp-includes/class-wp-hook.php(334): WP_Hook->apply_filters()
    #6 wp-includes/plugin.php(517): WP_Hook->do_action()
    #7 wp-admin/includes/plugin.php(693): do_action()

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

Server-side resources used by Openpay Payment Gateway
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /3.46 ▲0.0037.35 ▼1.12
Dashboard /wp-admin3.31 ▲0.0046.14 ▼4.89
Posts /wp-admin/edit.php3.36 ▲0.0045.49 ▲6.53
Add New Post /wp-admin/post-new.php5.89 ▲0.0078.63 ▼23.79
Media Library /wp-admin/upload.php3.23 ▲0.0036.40 ▲4.78

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

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

Browser metrics Passed 4 tests

A check of browser resources used by Openpay Payment Gateway
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,789 ▲2814.16 ▼0.071.81 ▲0.0743.11 ▼1.77
Dashboard /wp-admin2,186 ▲95.52 ▼0.19100.47 ▲7.1443.59 ▲4.37
Posts /wp-admin/edit.php2,100 ▼32.00 ▲0.0032.95 ▼9.5433.61 ▼2.14
Add New Post /wp-admin/post-new.php1,531 ▼423.04 ▲5.06663.79 ▲39.9353.46 ▼16.33
Media Library /wp-admin/upload.php1,400 ▲34.25 ▲0.1097.76 ▲3.8543.49 ▲2.82

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

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
It is recommended to fix the following
  • This plugin does not fully uninstall, leaving 6 options in the database
    • widget_theysaidso_widget
    • db_upgraded
    • widget_recent-posts
    • widget_recent-comments
    • theysaidso_admin_options
    • can_compress_scripts

Smoke tests 75% 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 50% 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
  • 231× 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\\DocBlock\\Tags\\BaseTag' not found in wp-content/plugins/openpay-payment-gateway/lib/OpenpayApi/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Author.php:27
    • > PHP Fatal error
      Uncaught Error: Interface 'phpDocumentor\\Reflection\\DocBlock\\Tags\\Reference\\Reference' not found in wp-content/plugins/openpay-payment-gateway/lib/OpenpayApi/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Reference/Fqsen.php:21
    • > PHP Fatal error
      Uncaught Error: Interface 'Openpay\\Client\\Model\\ModelInterface' not found in wp-content/plugins/openpay-payment-gateway/lib/OpenpayApi/lib/Model/IntegrationApiModelsCommandsPosWebJourneyDetails.php:43
    • > PHP Fatal error
      Uncaught Error: Class 'GuzzleHttp7\\Exception\\BadResponseException' not found in wp-content/plugins/openpay-payment-gateway/lib/OpenpayApi/vendor-static/guzzlehttp/guzzle/src/Exception/ClientException.php:8
    • > PHP Fatal error
      Uncaught Error: Interface 'Doctrine\\Instantiator\\Exception\\ExceptionInterface' not found in wp-content/plugins/openpay-payment-gateway/lib/OpenpayApi/vendor/doctrine/instantiator/src/Doctrine/Instantiator/Exception/UnexpectedValueException.php:14
    • > PHP Fatal error
      Uncaught Error: Interface 'GuzzleHttp7\\Exception\\GuzzleException' not found in wp-content/plugins/openpay-payment-gateway/lib/OpenpayApi/vendor-static/guzzlehttp/guzzle/src/Exception/TransferException.php:5
    • > PHP Fatal error
      Uncaught Error: Class 'phpDocumentor\\Reflection\\DocBlock\\Tags\\BaseTag' not found in wp-content/plugins/openpay-payment-gateway/lib/OpenpayApi/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Link.php:25
    • > PHP Fatal error
      Uncaught Error: Class 'phpDocumentor\\Reflection\\Types\\String_' not found in wp-content/plugins/openpay-payment-gateway/lib/OpenpayApi/vendor/phpdocumentor/type-resolver/src/PseudoTypes/NonEmptyString.php:25
    • > PHP Fatal error
      Uncaught Error: Interface 'GuzzleHttp7\\Promise\\PromisorInterface' not found in wp-content/plugins/openpay-payment-gateway/lib/OpenpayApi/vendor-static/guzzlehttp/promises/src/EachPromise.php:9
    • > PHP Fatal error
      Uncaught Error: Interface 'Prophecy\\Argument\\Token\\TokenInterface' not found in wp-content/plugins/openpay-payment-gateway/lib/OpenpayApi/vendor/phpspec/prophecy/src/Prophecy/Argument/Token/AnyValueToken.php:19

User-side errors Passed 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the browser (console and network errors and warnings)
Everything seems fine on the user side

Optimizations

Plugin configuration 93% 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
Attributes that require attention:
  • Donate link: Invalid URI ("")
You can take inspiration from this readme.txt

openpay-payment-gateway/openpay.php 92% from 13 tests

The main file in "Openpay Payment Gateway" v. 1.2.3 serves as a complement to information provided in readme.txt and as the entry point to the plugin
The following require your attention:
  • Main file name: Even though not officially enforced, the main plugin file should be the same as the plugin slug ("openpay-payment-gateway.php" instead of "openpay.php")

Code Analysis 3% from 3 tests

File types 0% from 1 test

🔸 Test weight: 35 | This is a short overview of programming languages used in this plugin, detecting executable files
Almost there! Just fix the following issues
  • You should never include executable (binary) or otherwise dangerous files in your plugin
    • .bat - Batch File in Windows
      • wp-content/plugins/openpay-payment-gateway/lib/OpenpayApi/vendor/bin/phpcbf.bat
      • wp-content/plugins/openpay-payment-gateway/lib/OpenpayApi/vendor/bin/phpcs.bat
      • wp-content/plugins/openpay-payment-gateway/lib/OpenpayApi/vendor/bin/phpunit.bat
45,288 lines of code in 485 files:
LanguageFilesBlank linesComment linesLines of code
PHP3887,47222,32934,220
Markdown261,77004,895
YAML34157903,492
JSON17502,285
INI42015141
SVG10147
XML23043
JavaScript10036
reStructuredText2231831
Bourne Shell39330
Smarty20025
HTML11022
DOS Batch30012
make1409

PHP code 50% from 2 tests

This is a short overview of cyclomatic complexity and code structure for this plugin
It is recommended to fix the following
  • Cyclomatic complexity of methods should be reduced to less than 100 (currently 113)
Cyclomatic complexity
Average complexity per logical line of code0.45
Average class complexity12.41
▷ Minimum class complexity1.00
▷ Maximum class complexity367.00
Average method complexity2.52
▷ Minimum method complexity1.00
▷ Maximum method complexity113.00
Code structure
Namespaces57
Interfaces56
Traits4
Classes312
▷ Abstract classes51.60%
▷ Concrete classes30798.40%
▷ Final classes11236.48%
Methods2,791
▷ Static methods73826.44%
▷ Public methods2,47988.82%
▷ Protected methods341.22%
▷ Private methods2789.96%
Functions193
▷ Named functions5528.50%
▷ Anonymous functions13871.50%
Constants168
▷ Global constants42.38%
▷ Class constants16497.62%
▷ Public constants14487.80%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
No PNG images were found in this plugin