You are here

public function HMSService::normalize_format in HMS Field 8

Helper to normalize format.

Changes double keys to single keys.

Parameters

$format:

Return value

mixed

Overrides HMSServiceInterface::normalize_format

1 call to HMSService::normalize_format()
HMSService::formatted_to_seconds in src/HMSService.php
Returns number of seconds from a formatted string.

File

src/HMSService.php, line 243

Class

HMSService
Provides a service to handle various hms related functionality.

Namespace

Drupal\hms_field

Code

public function normalize_format($format) {
  $keys = array_keys($this
    ->factor_map());
  $search_keys = array_map([
    $this,
    'add_multi_search_tokens',
  ], $keys);
  return preg_replace($search_keys, $keys, $format);
}