/** * @param string $style * * @return IConsoleStyle */ public function parseStyle($style) { $groups = $this->formatParser->parseStyle($style); foreach ($groups as $group) { $type = $group[1]; $value = $group[2]; if (array_contains(['color', 'clr', 'fg'], $type)) { foreach (explode(',', $value) as $color) { $this->setColor($color); } } if (array_contains(['background', 'bg'], $type)) { foreach (explode(',', $value) as $background) { $this->setBackground($background); } } if (array_contains(['format', 'fmt'], $type)) { foreach (explode(',', $value) as $format) { $this->addFormat($format); } } } return $this; }