maintenance-1.0.0-beta1/src/MaintenanceManagerInterface.php
src/MaintenanceManagerInterface.php
<?php
namespace Drupal\maintenance;
use Drupal\Core\Config\Config;
use Drupal\Core\Config\ImmutableConfig;
/**
* Defines the interface for the maintenance manager service.
*/
interface MaintenanceManagerInterface {
/**
* Retrieves the editable configuration object for the module.
*
* @return \Drupal\Core\Config\Config|\Drupal\Core\Config\ImmutableConfig
* The editable or immutable config object.
*/
public function getConfig(): ImmutableConfig|Config;
/**
* Returns the default datetime format string.
*
* @return string
* The default datetime format.
*/
public function getDefaultDateFormat(): string;
/**
* Provides a list of allowed offset time units.
*
* @return array
* An associative array of unit keys and their human-readable labels.
*/
public function getAllowedUnits(): array;
/**
* Returns a list of allowed IP addresses from config.
*
* @return string[]
* An array of IP addresses and CIDR ranges.
*/
public function getAllowedIps(): array;
/**
* Returns a list of allowed route paths from config.
*
* @return string[]
* An array of allowed URL path patterns.
*/
public function getAllowedUrls(): array;
/**
* Returns a list of available themes for the maintenance page.
*
* @param array $options
* Optional options passed by modules.
*
* @return array
* A keyed array of theme options.
*/
public function getAvailableThemes(array $options = []): array;
/**
* Returns a list of supported HTTP status codes and their labels.
*
* @return array
* An associative array of status codes and descriptions.
*/
public function getHttpStatusCodes(): array;
/**
* Returns the label for a given HTTP status code.
*
* @param int $code
* The status code.
*
* @return string|null
* The label, or NULL if unknown.
*/
public function getHttpStatusLabel(int $code): ?string;
/**
* Checks whether the current user has access to bypass maintenance mode.
*
* @return bool
* TRUE if the user has access, FALSE otherwise.
*/
public function hasAccess(): bool;
/**
* Checks whether an IP matches any configured CIDR range.
*
* @param string $ip
* The IP address to check.
*
* @return bool
* TRUE if a match is found.
*/
public function isCidrMatch(string $ip): bool;
/**
* Checks if an IP address falls within a specified CIDR range.
*
* @param string $ip
* The IP address to check (e.g., '192.168.1.100').
* @param string $cidr
* The CIDR notation defining the network range (e.g., '192.168.1.0/24').
*
* @return bool
* TRUE if the IP falls within the given CIDR range, FALSE otherwise.
*/
public function checkCidrMatch(string $ip, string $cidr): bool;
}
