90% turn-off-rest-api

Code Review | Turn Off REST API

WordPress plugin Turn Off REST API scored90%from 54 tests.

About plugin

  • Plugin page: turn-off-rest-api
  • Plugin version: 1.0.4
  • PHP version: 7.4.16
  • WordPress compatibility: 4.7-5.4
  • WordPress version: 6.3.1
  • First release: Mar 23, 2017
  • Latest release: Jul 1, 2020
  • Number of updates: 16
  • Update frequency: every 74.6 days
  • Top authors: ksym04 (100%)

Code review

54 tests

User reviews

1 review

Install metrics

100+ active /1,665 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | All plugins must install correctly, without throwing any errors, warnings, or notices
Install script ran successfully

Server metrics [RAM: ▲0.03MB] [CPU: ▼2.61ms] Passed 4 tests

An overview of server-side resources used by Turn Off REST API
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /3.49 ▲0.0343.69 ▲4.16
Dashboard /wp-admin3.34 ▲0.0350.73 ▲2.16
Posts /wp-admin/edit.php3.39 ▲0.0350.04 ▲2.58
Add New Post /wp-admin/post-new.php5.94 ▲0.0581.55 ▼12.25
Media Library /wp-admin/upload.php3.26 ▲0.0333.69 ▼2.93
Turn Off REST API /wp-admin/options-general.php?page=turnoff_rest_api_settings4.6236.77

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

How much does this plugin use your filesystem and database?
This plugin was installed successfully
Filesystem: 14 new files
Database: no new tables, 6 new options
New WordPress options
can_compress_scripts
db_upgraded
widget_theysaidso_widget
theysaidso_admin_options
widget_recent-comments
widget_recent-posts

Browser metrics Passed 4 tests

An overview of browser requirements for Turn Off REST API
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,796 ▲3514.42 ▲0.071.72 ▲0.0843.39 ▲3.23
Dashboard /wp-admin2,203 ▲235.64 ▼0.0285.04 ▼3.0538.82 ▲1.40
Posts /wp-admin/edit.php2,087 ▼132.11 ▲0.1534.78 ▲0.5234.49 ▲0.43
Add New Post /wp-admin/post-new.php1,542 ▲1618.20 ▼5.00592.17 ▼118.6063.03 ▲9.78
Media Library /wp-admin/upload.php1,402 ▲54.17 ▼0.0297.97 ▲2.0640.88 ▼4.98
Turn Off REST API /wp-admin/options-general.php?page=turnoff_rest_api_settings1,8342.1925.0630.12

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
You still need to fix the following
  • This plugin does not fully uninstall, leaving 6 options in the database
    • db_upgraded
    • can_compress_scripts
    • widget_theysaidso_widget
    • widget_recent-comments
    • widget_recent-posts
    • theysaidso_admin_options

Smoke tests Passed 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a short smoke test looking for server-side errors
Even though no errors were found, this is by no means an exhaustive test

SRP Passed 2 tests

🔹 Tests weight: 20 | It is important to ensure that your PHP files perform no action when accessed directly, respecting the single-responsibility principle
Looking good! No server-side errors or output on direct access of PHP files

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 Passed 29 tests

readme.txt Passed 16 tests

The readme.txt file is important because it is parsed by WordPress.org for the public listing of your plugin
5 plugin tags: api, disable rest api, json, admin, rest

turn-off-rest-api/turn-off-rest-api.php Passed 13 tests

The primary PHP file in "Turn Off REST API" version 1.0.4 is used by WordPress to initiate all plugin functionality
58 characters long description:
Prevents unauthorized requests from using the WP REST API.

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short review of files and their extensions; it is not recommended to include executable files
No dangerous file extensions were detected312 lines of code in 8 files:
LanguageFilesBlank linesComment linesLines of code
PHP464197207
Markdown125041
PO File1121241
CSS13113
JavaScript12110

PHP code Passed 2 tests

This is a short overview of cyclomatic complexity and code structure for this plugin
No cyclomatic complexity issues were detected for this plugin
Cyclomatic complexity
Average complexity per logical line of code0.31
Average class complexity15.00
▷ Minimum class complexity15.00
▷ Maximum class complexity15.00
Average method complexity2.00
▷ Minimum method complexity1.00
▷ Maximum method complexity7.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes1
▷ Abstract classes00.00%
▷ Concrete classes1100.00%
▷ Final classes00.00%
Methods14
▷ Static methods00.00%
▷ Public methods857.14%
▷ Protected methods00.00%
▷ Private methods642.86%
Functions4
▷ Named functions375.00%
▷ Anonymous functions125.00%
Constants0
▷ Global constants00.00%
▷ Class constants00.00%
▷ Public constants00.00%

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