class Tags extends StringMutator (View source)

Replaces tags {{ tag }} in a string with values from a map.

Available options:

  • forceLowerCaseKeys (bool): Force all keys to be lower case. Defaults to false.
  • throwWhenMissing (bool): Throw an exception when a tag is missing. Defaults to false.
  • removeOnMissing (mixed): Remove the tag when it is missing. Defaults to false.

Example:

$tags = [
   'name' => 'General Kenobi',
];

Tags::make($tags)->mutate('Hello there, {{ name }}!'); // 'Hello there, General Kenobi!'

Traits

Methods

__construct(array $tags, array $options = [])

No description

mixed
__invoke(mixed $value)

Mutate the input value.

from  Mutator
static Tags
make(array $tags, array $options = [])

No description

mixed
mutate(mixed $value)

Mutate the input value.

string
mutateString(string $value)

No description

string
resolveStringInput(mixed $value)

No description

Details

__construct(array $tags, array $options = [])

No description

Parameters

array $tags

The tags to replace.

array $options

The options to use.

final mixed __invoke(mixed $value)

Mutate the input value.

Parameters

mixed $value

Return Value

mixed

static Tags make(array $tags, array $options = [])

No description

Parameters

array $tags

The tags to replace.

array $options

The options to use.

Return Value

Tags

final mixed mutate(mixed $value)

Mutate the input value.

Parameters

mixed $value

Return Value

mixed

protected string mutateString(string $value)

No description

Parameters

string $value

Return Value

string

protected string resolveStringInput(mixed $value)

No description

Parameters

mixed $value

Return Value

string