94% 2c2p-redirect-api-for-woocommerce

Code Review | 2C2P Redirect API for WooCommerce

WordPress plugin 2C2P Redirect API for WooCommerce scored 94% from 54 tests.

About plugin

  • Plugin page: 2c2p-redirect-api...
  • Plugin version: 7.0.3
  • PHP version: 7.4.16
  • WordPress compatibility: 2.6.0-4.8
  • WordPress version: 5.9.2
  • First release: Jun 20, 2017
  • Latest release: Jun 4, 2018
  • Number of updates: 15
  • Update frequency: every 23.7 days
  • Top authors: 2c2p (100%)

Code review

54 tests

User reviews

1 review

Install metrics

1,000+ active / 4,642 total downloads

Benchmarks

Plugin footprint Passed 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | It is important to correctly install your plugin, without throwing errors or notices
The plugin installed successfully, without throwing any errors or notices

Server metrics [RAM: ▲0.08MB] [CPU: ▼289.10ms] Passed 4 tests

Server-side resources used by 2C2P Redirect API for WooCommerce
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /3.68 ▲0.1761.00 ▲6.19
Dashboard /wp-admin3.51 ▲0.1139.48 ▲3.06
Posts /wp-admin/edit.php3.74 ▲0.1040.69 ▼11.22
Add New Post /wp-admin/post-new.php6.97 ▲0.0198.70 ▼1,154.42
Media Library /wp-admin/upload.php3.39 ▲0.1034.33 ▲9.44

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

Filesystem and database footprint
The plugin installed successfully
Filesystem: 14 new files
Database: no new tables, no new options

Browser metrics Passed 4 tests

A check of browser resources used by 2C2P Redirect API for WooCommerce
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,810 ▲5616.63 ▲0.656.09 ▼0.512.37 ▼0.45
Dashboard /wp-admin2,903 ▲196.46 ▼0.11134.82 ▼9.88154.58 ▼6.13
Posts /wp-admin/edit.php2,691 ▼03.43 ▲0.0062.58 ▲1.27143.76 ▲0.40
Add New Post /wp-admin/post-new.php1,658 ▼320.64 ▲4.10464.29 ▲25.18195.28 ▲34.05
Media Library /wp-admin/upload.php1,692 ▼95.71 ▲0.02144.73 ▼2.44183.30 ▼4.62

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
This plugin's uninstaller ran successfully

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for server-side errors
Everything seems fine, however this is by no means an exhaustive test

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
Almost there! Just fix the following items
  • 3× PHP files trigger server errors when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function __() in wp-content/plugins/2c2p-redirect-api-for-woocommerce/Includes/wc-2c2p-setting.php:5
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/2c2p-redirect-api-for-woocommerce/2c2p.php:10
    • > PHP Fatal error
      Uncaught Error: Class 'WC_Payment_Gateway' not found in wp-content/plugins/2c2p-redirect-api-for-woocommerce/Includes/wc-2c2p-request-helper.php:3

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for browser errors
No browser errors were detected

Optimizations

Plugin configuration 93% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file is an important file in your plugin as it is parsed by WordPress.org to prepare the public listing of your plugin
Please fix the following attributes:
  • Screenshots: These screenshots require images: #1 (Open the plugin's setting page and enter configuration setting field for 2c2p payment.), #2 (During checkout, customer can select 2C2P Payment and also select previously stored cards (if enabled stored card payment)), #3 (Customer shall be redirected to 2C2P's payment page, where they will be able to save their card (if enabled stored card payment)), #4 (Customer can see the payment result page.)
The official readme.txt is a good inspiration

2c2p-redirect-api-for-woocommerce/2c2p.php 92% from 13 tests

"2C2P Redirect API for WooCommerce" version 7.0.3's main PHP file describes plugin functionality and also serves as the entry point to any WordPress functionality
Please take the time to fix the following:
  • Main file name: The principal plugin file should be the same as the plugin slug ("2c2p-redirect-api-for-woocommerce.php" instead of "2c2p.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | This is an overview of file extensions present in this plugin and a short test that no dangerous files are bundled with this plugin
There were no executable files found in this plugin1,357 lines of code in 9 files:
LanguageFilesBlank linesComment linesLines of code
PHP7252501,252
Markdown113057
JavaScript17248

PHP code Passed 2 tests

A brief analysis of cyclomatic complexity and code structure for this plugin
This plugin has no cyclomatic complexity issues
Cyclomatic complexity
Average complexity per logical line of code0.66
Average class complexity38.71
▷ Minimum class complexity1.00
▷ Maximum class complexity100.00
Average method complexity9.25
▷ Minimum method complexity1.00
▷ Maximum method complexity68.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes7
▷ Abstract classes00.00%
▷ Concrete classes7100.00%
▷ Final classes00.00%
Methods32
▷ Static methods00.00%
▷ Public methods32100.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions9
▷ Named functions9100.00%
▷ Anonymous functions00.00%
Constants2
▷ Global constants00.00%
▷ Class constants2100.00%
▷ Public constants2100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
4 PNG files occupy 0.25MB with 0.17MB in potential savings
Potential savings
Compression of 4 random PNG files using pngquant
FileSize - originalSize - compressedSavings
screenshot-1.png61.71KB19.86KB▼ 67.82%
screenshot-3.png63.83KB20.87KB▼ 67.30%
screenshot-2.png55.03KB16.63KB▼ 69.78%
screenshot-4.png78.79KB23.58KB▼ 70.07%