Automattic\WooCommerce\Internal\PushNotifications\Services
DriverAvailabilityService::driver_status
Builds a single driver's status flags. A driver is available (usable now) only when it is both connected and enabled.
A driver is only available when both flags are definitively true. An undetermined flag is not usable, so null makes the driver unavailable in the same way false does.
Method of the class: DriverAvailabilityService{}
No Hooks.
Returns
array{connected: bool|null, enabled: bool|null, available: bool}.
Usage
// private - for code of main (parent) class only $result = $this->driver_status( ?bool $connected, ?bool $enabled ): array;
- ?bool $connected(required)
- .
- ?bool $enabled(required)
- .
DriverAvailabilityService::driver_status() DriverAvailabilityService::driver status code WC 11.3.0
private function driver_status( ?bool $connected, ?bool $enabled ): array {
return array(
'connected' => $connected,
'enabled' => $enabled,
'available' => true === $connected && true === $enabled,
);
}