You are here

protected function ConfigManager::validateHeadersToRemoveDataFormat in Remove HTTP headers 8

Checks if given array containing headers to remove has the correct format.

Parameters

mixed $headersToRemove: Expected: Array with headers that should be removed.

Return value

array|null The given array. NULL if not every array item is a string.

2 calls to ConfigManager::validateHeadersToRemoveDataFormat()
ConfigManager::getHeadersToRemoveFromCache in src/Config/ConfigManager.php
Returns the configured headers to remove from cache.
ConfigManager::getHeadersToRemoveFromConfig in src/Config/ConfigManager.php
Returns the configured headers to remove from configuration.

File

src/Config/ConfigManager.php, line 140

Class

ConfigManager
Manages module configuration.

Namespace

Drupal\remove_http_headers\Config

Code

protected function validateHeadersToRemoveDataFormat($headersToRemove = NULL) : ?array {
  if (!is_array($headersToRemove)) {
    return NULL;
  }
  foreach ($headersToRemove as $headerToRemove) {
    if (!is_string($headerToRemove)) {
      return NULL;
    }
  }
  return $headersToRemove;
}