EnsureDynamicContentIsHighlighted.php
TLDR
This file contains a class named EnsureDynamicContentIsHighlighted
in the namespace Illuminate\Console\View\Components\Mutators
. The class has a single method called __invoke
which highlights dynamic content within a given string.
Classes
EnsureDynamicContentIsHighlighted
This class is responsible for highlighting dynamic content within a given string. It provides a single method called __invoke
.
Methods
__invoke($string)
This method accepts a string parameter and returns the updated string with dynamic content highlighted. It uses regular expressions to find the dynamic content enclosed within square brackets and replaces it with the same content surrounded by <options=bold>
tags.
<?php
namespace Illuminate\Console\View\Components\Mutators;
class EnsureDynamicContentIsHighlighted
{
/**
* Highlight dynamic content within the given string.
*
* @param string $string
* @return string
*/
public function __invoke($string)
{
return preg_replace('/\[([^\]]+)\]/', '<options=bold>[$1]</>', (string) $string);
}
}