SlugNormalizer
in package
implements
TextNormalizerInterface, ConfigurationAwareInterface
FinalYes
Creates URL-friendly strings based on the given string input
Table of Contents
Interfaces
- TextNormalizerInterface
- Creates a normalized version of the given input text
- ConfigurationAwareInterface
- Implement this class to facilitate setter injection of the configuration where needed
Properties
- $defaultMaxLength : int
Methods
- normalize() : string
- setConfiguration() : void
Properties
$defaultMaxLength
private
int
$defaultMaxLength
= 255
Tags
Methods
normalize()
public
normalize(string $text[, array<string|int, mixed> $context = [] ]) : string
Parameters
- $text : string
-
The text to normalize
- $context : array<string|int, mixed> = []
-
Additional context about the text being normalized (optional)
$context may include (but is not required to include) the following:
prefix- A string prefix to prepend to each normalized resultlength- The requested maximum lengthnode- The node we're normalizing text for
Implementations do not have to use or respect any information within that $context
Tags
Return values
stringsetConfiguration()
public
setConfiguration(ConfigurationInterface $configuration) : void
Parameters
- $configuration : ConfigurationInterface