84% payment-gateway-for-ba-paypal

Code Review | Payment Gateway for BA via PayPal

WordPress plugin Payment Gateway for BA via PayPal scored84%from 54 tests.

About plugin

  • Plugin page: payment-gateway-f...
  • Plugin version: 1.0.2
  • PHP compatiblity: 7.2+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.9.1-5.6
  • WordPress version: 6.3.1
  • First release: Nov 4, 2020
  • Latest release: Jan 5, 2021
  • Number of updates: 13
  • Update frequency: every 4.8 days
  • Top authors: nguyendiep208 (100%)

Code review

54 tests

User reviews

1 review

Install metrics

100+ active /752 total downloads

Benchmarks

Plugin footprint 83% from 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 gracefully, with no errors

Server metrics [RAM: ▲0.27MB] [CPU: ▼6.92ms] Passed 4 tests

This is a short check of server-side resources used by Payment Gateway for BA via PayPal
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /3.74 ▲0.2835.67 ▼8.91
Dashboard /wp-admin3.57 ▲0.2748.05 ▲0.16
Posts /wp-admin/edit.php3.69 ▲0.3342.29 ▼7.18
Add New Post /wp-admin/post-new.php6.15 ▲0.2785.60 ▼11.75
Media Library /wp-admin/upload.php3.50 ▲0.2735.22 ▲1.48

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

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

Browser metrics Passed 4 tests

Payment Gateway for BA via PayPal: an overview of browser usage
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,800 ▲2913.18 ▼1.441.59 ▼0.2940.42 ▼3.73
Dashboard /wp-admin2,206 ▲185.88 ▼0.0197.52 ▼2.7736.42 ▼5.73
Posts /wp-admin/edit.php2,092 ▲31.99 ▼0.0734.31 ▼6.3531.82 ▼2.38
Add New Post /wp-admin/post-new.php1,533 ▼223.24 ▲5.03672.08 ▲56.8749.56 ▼5.20
Media Library /wp-admin/upload.php1,385 ▼34.17 ▼0.0399.57 ▲4.8044.69 ▲5.05

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

🔸 Tests weight: 35 | All plugins must uninstall correctly, removing their source code and extra database tables they might have created
The following items require your attention
  • This plugin did not uninstall successfully, leaving 6 options in the database
    • db_upgraded
    • widget_theysaidso_widget
    • theysaidso_admin_options
    • can_compress_scripts
    • widget_recent-posts
    • widget_recent-comments

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no server-side errors were triggered
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
The following issues need your attention
  • 502× GET requests to PHP files have triggered server-side errors or warnings (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'PHPUnit_Framework_TestCase' not found in wp-content/plugins/payment-gateway-for-ba-paypal/paypal-sdk/phpunit/phpunit/tests/_files/NotVoidTestCase.php:2
    • > PHP Fatal error
      Uncaught Error: Class 'PHPUnit_Framework_Constraint' not found in wp-content/plugins/payment-gateway-for-ba-paypal/paypal-sdk/phpunit/phpunit/src/Framework/Constraint/LessThan.php:17
    • > PHP Fatal error
      Uncaught Error: Class 'PHPUnit_Framework_TestCase' not found in wp-content/plugins/payment-gateway-for-ba-paypal/paypal-sdk/phpunit/phpunit/tests/_files/FatalTest.php:3
    • > PHP Fatal error
      Uncaught Error: Class 'PHPUnit_Framework_TestCase' not found in wp-content/plugins/payment-gateway-for-ba-paypal/paypal-sdk/phpunit/php-code-coverage/tests/_files/CoverageFunctionParenthesesTest.php:2
    • > PHP Fatal error
      Uncaught Error: Class 'PHPUnit_Util_Printer' not found in wp-content/plugins/payment-gateway-for-ba-paypal/paypal-sdk/phpunit/phpunit/src/Util/Log/JUnit.php:18
    • > PHP Fatal error
      Uncaught Error: Class 'PHPUnit_Framework_Constraint' not found in wp-content/plugins/payment-gateway-for-ba-paypal/paypal-sdk/phpunit/phpunit/src/Framework/Constraint/Exception.php:14
    • > PHP Fatal error
      Uncaught Error: Class 'AbstractTest' not found in wp-content/plugins/payment-gateway-for-ba-paypal/paypal-sdk/phpunit/phpunit/tests/_files/ConcreteTest.my.php:2
    • > PHP Fatal error
      Uncaught Error: Class 'PHPUnit_Framework_TestCase' not found in wp-content/plugins/payment-gateway-for-ba-paypal/paypal-sdk/phpunit/php-code-coverage/tests/_files/CoverageNothingTest.php:2
    • > PHP Fatal error
      Uncaught Error: Interface 'PHPUnit_Exception' not found in wp-content/plugins/payment-gateway-for-ba-paypal/paypal-sdk/phpunit/phpunit/src/Runner/Exception.php:14
    • > PHP Fatal error
      Uncaught Error: Interface 'PHPUnit_Framework_MockObject_Builder_Identity' not found in wp-content/plugins/payment-gateway-for-ba-paypal/paypal-sdk/phpunit/phpunit-mock-objects/src/Framework/MockObject/Builder/Stub.php:16

User-side errors Passed 1 test

🔹 Test weight: 20 | This is just a short smoke test looking for browser issues
No browser issues were found

Optimizations

Plugin configuration 97% from 29 tests

readme.txt 94% from 16 tests

You should put a lot of thought into formatting readme.txt as it is used by WordPress.org to prepare the public listing of your plugin
Attributes that need to be fixed: You can look at the official readme.txt

payment-gateway-for-ba-paypal/payment-gateway-for-ba-paypal.php Passed 13 tests

"Payment Gateway for BA via PayPal" version 1.0.2's primary PHP file adds more information about the plugin and serves as the entry point for WordPress
57 characters long description:
Integrates PayPal payments into BA Book Everything plugin

Code Analysis 97% from 3 tests

File types Passed 1 test

🔸 Test weight: 35 | There should be no dangerous file extensions present in any WordPress plugin
Good job! No executable or dangerous file extensions detected64,538 lines of code in 1,031 files:
LanguageFilesBlank linesComment linesLines of code
PHP83812,00527,99453,787
YAML50247903,948
Markdown421,11102,340
JSON291202,210
XML479713951
Ant10910573
SVG100288
XSD100264
CSS326498
reStructuredText2231831
make17028
JavaScript752120

PHP code 50% from 2 tests

This is a short overview of cyclomatic complexity and code structure for this plugin
These items need your attention
  • Method cyclomatic complexity has to be reduced to less than 100 (currently 154)
Cyclomatic complexity
Average complexity per logical line of code0.36
Average class complexity6.58
▷ Minimum class complexity1.00
▷ Maximum class complexity259.00
Average method complexity2.40
▷ Minimum method complexity1.00
▷ Maximum method complexity154.00
Code structure
Namespaces56
Interfaces72
Traits3
Classes857
▷ Abstract classes323.73%
▷ Concrete classes82596.27%
▷ Final classes546.55%
Methods3,962
▷ Static methods66616.81%
▷ Public methods3,39285.61%
▷ Protected methods3087.77%
▷ Private methods2626.61%
Functions214
▷ Named functions16577.10%
▷ Anonymous functions4922.90%
Constants127
▷ Global constants1411.02%
▷ Class constants11388.98%
▷ Public constants10492.04%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
1 PNG file occupies 0.01MB with 0.01MB in potential savings
Potential savings
Compression of 1 random PNG file using pngquant
FileSize - originalSize - compressedSavings
images/paypal-logo.png15.20KB4.83KB▼ 68.22%