You are here

class CacheTagFormatter in Akamai 8.3

Provides formatting to help cache tags conform Akamai requirements.

Hierarchy

Expanded class hierarchy of CacheTagFormatter

See also

https://developer.akamai.com/api/purge/ccu/overview.html

3 files declare their use of CacheTagFormatter
AkamaiTagPurgerTest.php in tests/src/Unit/Plugin/Purge/Purger/AkamaiTagPurgerTest.php
CacheableResponseSubscriber.php in src/EventSubscriber/CacheableResponseSubscriber.php
CacheTagFormatterTest.php in tests/src/Unit/Helper/CacheTagFormatterTest.php
1 string reference to 'CacheTagFormatter'
akamai.services.yml in ./akamai.services.yml
akamai.services.yml
1 service uses CacheTagFormatter
akamai.helper.cachetagformatter in ./akamai.services.yml
Drupal\akamai\Helper\CacheTagFormatter

File

src/Helper/CacheTagFormatter.php, line 10

Namespace

Drupal\akamai\Helper
View source
class CacheTagFormatter {
  const RESTRICTED_CHARS_PATTERN = '/[\\s\\*\\"\\(\\)\\,\\:\\;\\<\\=\\>\\?\\@\\\\[\\]\\{\\}]/';

  /**
   * Format tag according to Akamai guidelines.
   *
   * @param string $tag
   *   A cache tag string.
   *
   * @return string
   *   A compliant cache tag string.
   */
  public function format($tag) {
    $tag = (string) $tag;
    $tag = preg_replace(self::RESTRICTED_CHARS_PATTERN, '_', $tag);
    return $tag;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
CacheTagFormatter::format public function Format tag according to Akamai guidelines.
CacheTagFormatter::RESTRICTED_CHARS_PATTERN constant