PluginProbe
Manage – Centralized site maintenance and monitoring / trunk
Manage – Centralized site maintenance and monitoring vtrunk
1.0.9 1.0.8 1.0.7 1.0.6 1.0.5 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.0.4
manage / classes / lighthouse-client.php

lighthouse-client.php in Manage – Centralized site maintenance and monitoring trunk, at classes/lighthouse-client.php

47 lines 1.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace Manage\Classes;
3
4 use ElementorOne\Connect\Classes\GrantTypes;
5 use Manage\Modules\Connect\Module as Connect;
6
7 if ( ! defined( 'ABSPATH' ) ) {
8 exit;
9 }
10
11 class Lighthouse_Client extends Platform_Client {
12 private static ?Lighthouse_Client $instance = null;
13
14 protected static function get_api_path(): string {
15 return apply_filters( 'manage/lighthouse_api_base_url', 'performance-metrics/api/v1/' );
16 }
17
18 protected static function get_grant_type(): string {
19 return GrantTypes::REFRESH_TOKEN;
20 }
21
22 public static function get_instance(): Lighthouse_Client {
23 if ( ! self::$instance ) {
24 self::$instance = new self();
25 }
26
27 return self::$instance;
28 }
29
30 public function get_site_performance( array $categories = [ 'performance', 'seo', 'accessibility' ], bool $force = false ) {
31 $connect_data = Connect::get_connect()->data();
32 $site_id = $connect_data->get_client_id();
33
34 return $this->make_request(
35 'POST',
36 'site-performance',
37 [
38 'siteId' => $site_id,
39 'categories' => $categories,
40 'force' => $force,
41 ],
42 [],
43 true
44 );
45 }
46 }
47