10% lnp-api-client

Code Review | Niki API Client

WordPress plugin Niki API Client scored10%from 54 tests.

About plugin

  • Plugin page: lnp-api-client
  • Plugin version: 0.3.1
  • PHP version: 7.4.16
  • WordPress compatibility: 3.0.1-4.9.4
  • WordPress version: 6.3.1
  • First release: Mar 18, 2019
  • Latest release: Mar 18, 2019
  • Number of updates: 3
  • Update frequency: every 64.4 days
  • Top authors: fundamentallmedia (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /572 total downloads

Benchmarks

Plugin footprint 58% from 16 tests

Installer 0% from 1 test

🔺 Critical test (weight: 50) | It is important to correctly install your plugin, without throwing errors or notices
It is recommended to fix the following installer errors
  • The plugin cannot be installed
    • > Deprecated in wp-content/plugins/lnp-api-client/niki-api-client.php+61
    Non-static method Niki_Plugin::flush_rewrite_rules() should not be called statically

Server metrics [RAM: ▲0.25MB] [CPU: ▼2.28ms] Passed 4 tests

An overview of server-side resources used by Niki API Client
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /3.73 ▲0.2637.15 ▼1.69
Dashboard /wp-admin3.57 ▲0.2247.04 ▼10.26
Posts /wp-admin/edit.php3.69 ▲0.3252.04 ▲7.92
Add New Post /wp-admin/post-new.php6.15 ▲0.26103.11 ▲4.41
Media Library /wp-admin/upload.php3.49 ▲0.2634.57 ▼1.58
Niki Server /wp-admin/admin.php?page=niki_server3.4433.35
Niki Projecten /wp-admin/admin.php?page=niki_projects3.4630.78

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

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

Browser metrics Passed 4 tests

Niki API Client: an overview of browser usage
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,816 ▲5514.34 ▼0.011.50 ▼0.2438.24 ▼3.05
Dashboard /wp-admin2,225 ▲455.57 ▼0.2283.31 ▼7.5341.71 ▲1.58
Posts /wp-admin/edit.php2,127 ▲272.03 ▲0.0538.73 ▲0.6336.53 ▼0.55
Add New Post /wp-admin/post-new.php1,547 ▲1923.17 ▲0.12634.08 ▼43.7452.74 ▲2.92
Media Library /wp-admin/upload.php1,427 ▲274.24 ▲0.0493.92 ▼5.3245.82 ▼1.72
Niki Server /wp-admin/admin.php?page=niki_server8282.0322.8128.63
Niki Projecten /wp-admin/admin.php?page=niki_projects8051.9924.8732.56

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
It is recommended to fix the following
  • Zombie WordPress options were found after uninstall: 6 options
    • widget_recent-posts
    • db_upgraded
    • can_compress_scripts
    • theysaidso_admin_options
    • widget_theysaidso_widget
    • widget_recent-comments

Smoke tests 25% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | A shallow check that no server-side errors were triggered
These errors were triggered by the plugin
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=niki_server
    • > Notice in wp-content/plugins/lnp-api-client/classes/class-niki_plugin_base.php+636
    Trying to access array offset on value of type bool

SRP 0% 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
Please fix the following items
  • 2× PHP files perform the task of outputting text when accessed with GET requests:
    • > /wp-content/plugins/lnp-api-client/niki-api-client.php
    • > /wp-content/plugins/lnp-api-client/classes/class-niki_api.php
  • 11× GET requests to PHP files trigger server-side errors or Error 500 responses (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Using $this when not in object context in wp-content/plugins/lnp-api-client/examples/classes/interest_confirm_mail.php:23
    • > PHP Warning
      Use of undefined constant WP_DEBUG - assumed 'WP_DEBUG' (this will throw an Error in a future version of PHP) in wp-content/plugins/lnp-api-client/examples/theme/niki-template/index.php on line 10
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_header() in wp-content/plugins/lnp-api-client/examples/theme/niki-template/index.php:21
    • > PHP Warning
      Use of undefined constant WP_DEBUG - assumed 'WP_DEBUG' (this will throw an Error in a future version of PHP) in wp-content/plugins/lnp-api-client/classes/debug.php on line 58
    • > PHP Fatal error
      require_once(): Failed opening required 'ABSPATHwp-admin/includes/template.php' (include_path='.:/usr/share/php') in wp-content/plugins/lnp-api-client/classes/class-niki_plugin_base.php on line 44
    • > ▒▒▒▒▒NEW REQUEST (2023-10-20 22
      37:01)▒▒▒▒▒
    • > PHP Warning
      Use of undefined constant ABSPATH - assumed 'ABSPATH' (this will throw an Error in a future version of PHP) in wp-content/plugins/lnp-api-client/classes/class-niki_plugin_base.php on line 44
    • > PHP Warning
      require_once(ABSPATHwp-admin/includes/template.php): failed to open stream: No such file or directory in wp-content/plugins/lnp-api-client/classes/class-niki_plugin_base.php on line 44
    • > niki template
      main index.php start
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/lnp-api-client/examples/theme/niki-template/functions.php:2

User-side errors Passed 1 test

🔹 Test weight: 20 | This is just a short smoke test looking for browser issues
Everything seems fine, but this is not an exhaustive test

Optimizations

Plugin configuration 93% from 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
3 plugin tags: niki rest api, client, api

lnp-api-client/niki-api-client.php 85% from 13 tests

The main file in "Niki API Client" v. 0.3.1 serves as a complement to information provided in readme.txt and as the entry point to the plugin
You should first fix the following items:
  • Main file name: It is recommended to name the main PHP file as the plugin slug ("lnp-api-client.php" instead of "niki-api-client.php")
  • Description: Please keep the plugin description shorter than 140 characters (currently 155 characters long)

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 plugin2,356 lines of code in 12 files:
LanguageFilesBlank linesComment linesLines of code
PHP113551,6772,288
CSS1131368

PHP code Passed 2 tests

Analyzing logical lines of code, cyclomatic complexity, and other code metrics
All good! No complexity issues found
Cyclomatic complexity
Average complexity per logical line of code0.38
Average class complexity57.29
▷ Minimum class complexity1.00
▷ Maximum class complexity114.00
Average method complexity6.47
▷ Minimum method complexity1.00
▷ Maximum method complexity47.00
Code structure
Namespaces0
Interfaces1
Traits0
Classes6
▷ Abstract classes116.67%
▷ Concrete classes583.33%
▷ Final classes00.00%
Methods76
▷ Static methods1418.42%
▷ Public methods5065.79%
▷ Protected methods11.32%
▷ Private methods2532.89%
Functions8
▷ Named functions8100.00%
▷ Anonymous functions00.00%
Constants6
▷ Global constants350.00%
▷ Class constants350.00%
▷ Public constants3100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

PNG files should be compressed to save space and minimize bandwidth usage
No PNG images were found in this plugin