Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 9 |
|
0.00% |
0 / 3 |
CRAP | |
0.00% |
0 / 1 |
| SiteApisConfig | |
0.00% |
0 / 9 |
|
0.00% |
0 / 3 |
20 | |
0.00% |
0 / 1 |
| hosting_uapi_base_url | |
0.00% |
0 / 5 |
|
0.00% |
0 / 1 |
6 | |||
| hiive_request_timeout_seconds | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
2 | |||
| hosting_uapi_request_timeout_seconds | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace NewfoldLabs\WP\Module\Performance\Helpers; |
| 4 | |
| 5 | /** |
| 6 | * Centralized defaults for outbound site APIs (Hiive / Hosting UAPI). |
| 7 | */ |
| 8 | final class SiteApisConfig { |
| 9 | |
| 10 | /** |
| 11 | * Hosting UAPI base URL (trailing slash). |
| 12 | * |
| 13 | * Aligns with laravel-hiive `config('services.sites.api_base')` default. |
| 14 | */ |
| 15 | public static function hosting_uapi_base_url(): string { |
| 16 | if ( ! defined( 'NFD_SITES_API' ) ) { |
| 17 | // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedConstantFound -- Platform constant. |
| 18 | define( 'NFD_SITES_API', 'https://hosting.uapi.newfold.com/' ); |
| 19 | } |
| 20 | |
| 21 | $base = (string) constant( 'NFD_SITES_API' ); |
| 22 | $base = apply_filters( 'newfold_performance_hosting_uapi_base_url', $base ); |
| 23 | |
| 24 | return trailingslashit( $base ); |
| 25 | } |
| 26 | |
| 27 | /** |
| 28 | * Request timeout in seconds for Hiive HTTP calls. |
| 29 | * |
| 30 | * @return int |
| 31 | */ |
| 32 | public static function hiive_request_timeout_seconds(): int { |
| 33 | $timeout = 30; |
| 34 | return (int) apply_filters( 'newfold_performance_hiive_request_timeout_seconds', $timeout ); |
| 35 | } |
| 36 | |
| 37 | /** |
| 38 | * Request timeout in seconds for Hosting UAPI HTTP calls. |
| 39 | * |
| 40 | * @return int |
| 41 | */ |
| 42 | public static function hosting_uapi_request_timeout_seconds(): int { |
| 43 | $timeout = 30; |
| 44 | return (int) apply_filters( 'newfold_performance_hosting_uapi_request_timeout_seconds', $timeout ); |
| 45 | } |
| 46 | } |