Automattic\WooCommerce\Internal\PushNotifications\Services

DriverAvailabilityService::driver_status │ private │ WC 1.0

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.

Метод класса: DriverAvailabilityService{}

Хуков нет.

Возвращает

array{connected: bool|null, enabled: bool|null, available: bool}.

Использование

// private - только в коде основоного (родительского) класса
$result = $this->driver_status( ?bool $connected, ?bool $enabled ): array;
?bool $connected(обязательный)
.
?bool $enabled(обязательный)
.

Код DriverAvailabilityService::driver_status() WC 11.2.2

private function driver_status( ?bool $connected, ?bool $enabled ): array {
	return array(
		'connected' => $connected,
		'enabled'   => $enabled,
		'available' => true === $connected && true === $enabled,
	);
}