Automattic\WooCommerce\Internal\PushNotifications\Services
DriverAvailabilityService::get_status
Builds the driver status: the installed drivers with their connected, enabled, and available flags, and which driver the site prefers.
Property names are snake_case per REST convention; the driver identifiers used as keys within installed_drivers are kebab-case slugs.
A flag is null when its check could not be performed, as distinct from false meaning the check ran and answered no.
Метод класса: DriverAvailabilityService{}
Хуков нет.
Возвращает
array{installed_drivers:. array<string, array{connected: bool|null, enabled: bool|null, available: bool}>, preferred_driver: string|null}
Использование
$DriverAvailabilityService = new DriverAvailabilityService(); $DriverAvailabilityService->get_status(): array;
Список изменений
| С версии 11.2.0 | Введена. |
Код DriverAvailabilityService::get_status() DriverAvailabilityService::get status WC 11.2.2
public function get_status(): array {
$this->failed_checks = array();
$installed_drivers = array();
if ( $this->is_jetpack_sync_installed() ) {
$installed_drivers[ self::DRIVER_JETPACK_SYNC ] = $this->driver_status(
$this->resolve( $this->has_user_connection(), self::CHECK_USER_CONNECTION ),
$this->resolve( $this->is_jetpack_sync_enabled(), self::CHECK_SYNC_ENABLED )
);
}
// The remote proxy driver ships with this module, so it is always present.
$installed_drivers[ self::DRIVER_REMOTE_PROXY ] = $this->driver_status(
$this->resolve( $this->has_blog_connection(), self::CHECK_BLOG_CONNECTION ),
$this->resolve( $this->is_remote_proxy_enabled(), self::CHECK_PROXY_ENABLED )
);
return array(
'installed_drivers' => $installed_drivers,
'preferred_driver' => $this->get_preferred_driver( $installed_drivers ),
);
}