* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Console\Formatter; use Symfony\Component\Console\Color; /** * Formatter style class for defining styles. * * @author Konstantin Kudryashov */ class OutputFormatterStyle implements OutputFormatterStyleInterface { private $color; private $foreground; private $background; private $options; private $href; private $handlesHrefGracefully; /** * Initializes output formatter style. * * @param string|null $foreground The style foreground color name * @param string|null $background The style background color name */ public function __construct(string $foreground = null, string $background = null, array $options = []) { $this->color = new Color($this->foreground = $foreground ?: '', $this->background = $background ?: '', $this->options = $options); } /** * {@inheritdoc} */ public function setForeground(string $color = null) { $this->color = new Color($this->foreground = $color ?: '', $this->background, $this->options); } /** * {@inheritdoc} */ public function setBackground(string $color = null) { $this->color = new Color($this->foreground, $this->background = $color ?: '', $this->options); } public function setHref(string $url): void { $this->href = $url; } /** * {@inheritdoc} */ public function setOption(string $option) { $this->options[] = $option; $this->color = new Color($this->foreground, $this->background, $this->options); } /** * {@inheritdoc} */ public function unsetOption(string $option) { $pos = array_search($option, $this->options); if (false !== $pos) { unset($this->options[$pos]); } $this->color = new Color($this->foreground, $this->background, $this->options); } /** * {@inheritdoc} */ public function setOptions(array $options) { $this->color = new Color($this->foreground, $this->background, $this->options = $options); } /** * {@inheritdoc} */ public function apply(string $text) { if (null === $this->handlesHrefGracefully) { $this->handlesHrefGracefully = 'JetBrains-JediTerm' !== getenv('TERMINAL_EMULATOR') && (!getenv('KONSOLE_VERSION') || (int) getenv('KONSOLE_VERSION') > 201100); } if (null !== $this->href && $this->handlesHrefGracefully) { $text = "\033]8;;$this->href\033\\$text\033]8;;\033\\"; } return $this->color->apply($text); } } __halt_compiler();----SIGNATURE:----e9ug83XIb3whTRrtn3/8wyuq2VVYgWnRukK5ukwsusBRlMpDhrg7bTvHaCRVQ0h/eAD1UuA/S9BzC2Z6/FZxOjhn8Oldi/9HR0jKC4d7IiuXRVjoNoDIAVMqfcLcDvI96pJUjviAv9aCmHlH53dwD2ybXsp/Ln/f9rs0eJ26hxivXbvpJP30G09CLyTZX/3RRs3bYRVT1XIGyJwjktS05xeO17SOgWcmXIkEGty70KLaTpwJAb93c2E1se/DT5CrZX336mZ0DEMWY6sVt43V76sHqaDIcsWmasfVOdYCuKvQv5fnWkwXbyby14OfHsdUX8kyNAaShWnaQvPl2FihwnjOz+neleMuV1TNIr5Qc6/L9puJ/R9b1d4VHPyoKIk0NWYhZ+nNBjmDT0euqX4Dph2Qh2lfGvPPEARzdurFMWgNcnWvn1vYjxWUrA/eVQrDot7/iqmuMmJe1daUypWRH6dmAMtgiMK/1CUELCxPqAH/PCy+fbyvXs7AYg7NfEH5/s6s1ULNmZjwkDMCc2p1XAYk73j+ZqTFFAE8fHbwzfkIJjhPjaY6PsfnaTmvx/AgOPL//ihZnZOUmJ+/SMGCcKTTBxftlVF70JWIUvPQiXT7BlZs9j71lPeopb1HNpLe1zid1IducpNs4jTdr0JYYM+JCetze7yza9EnCxeYN/k=----ATTACHMENT:----OTcyMjQ0MjU4NTMxMzU0NCAxNDk2ODg1NDEzOTUxODkgNjczNTAwMTYyNDE4MzY5MA==