From c60cc1601807078885a117140a97dbfdd24cd4fa Mon Sep 17 00:00:00 2001 From: Saade Date: Tue, 28 Nov 2023 12:47:03 -0300 Subject: [PATCH] fix: merge conflicts --- configure.php | 190 +------------------------------------------------- 1 file changed, 2 insertions(+), 188 deletions(-) diff --git a/configure.php b/configure.php index a3540d8..196f3fe 100644 --- a/configure.php +++ b/configure.php @@ -363,192 +363,6 @@ function removeDirectory($dir): void } } } - - $sequences = array_filter($sequences, function ($val) { - return $val !== null; - }); - - if (empty($sequences)) { - return $text; - } - - return $this->escSequence(implode(';', $sequences)) . $text . $this->escSequence(self::RESET_STYLE); - } - - /** - * @param bool $forceStyle - */ - public function setForceStyle($forceStyle) - { - $this->forceStyle = (bool) $forceStyle; - } - - /** - * @return bool - */ - public function isStyleForced() - { - return $this->forceStyle; - } - - /** - * @throws InvalidStyleException - * @throws \InvalidArgumentException - */ - public function setThemes(array $themes) - { - $this->themes = []; - foreach ($themes as $name => $styles) { - $this->addTheme($name, $styles); - } - } - - /** - * @param string $name - * @param array|string $styles - * - * @throws \InvalidArgumentException - * @throws InvalidStyleException - */ - public function addTheme($name, $styles) - { - if (is_string($styles)) { - $styles = [$styles]; - } - if (! is_array($styles)) { - throw new \InvalidArgumentException('Style must be string or array.'); - } - - foreach ($styles as $style) { - if (! $this->isValidStyle($style)) { - throw new InvalidStyleException($style); - } - } - - $this->themes[$name] = $styles; - } - - /** - * @return array - */ - public function getThemes() - { - return $this->themes; - } - - /** - * @param string $name - * @return bool - */ - public function hasTheme($name) - { - return isset($this->themes[$name]); - } - - /** - * @param string $name - */ - public function removeTheme($name) - { - unset($this->themes[$name]); - } - - /** - * @codeCoverageIgnore - * - * @return bool - */ - public function isSupported() - { - if (DIRECTORY_SEPARATOR === '\\') { - // phpcs:ignore Generic.PHP.NoSilencedErrors,PHPCompatibility.FunctionUse.NewFunctions.sapi_windows_vt100_supportFound - if (function_exists('sapi_windows_vt100_support') && @sapi_windows_vt100_support(STDOUT)) { - return true; - } elseif (getenv('ANSICON') !== false || getenv('ConEmuANSI') === 'ON') { - return true; - } - - return false; - } else { - // phpcs:ignore Generic.PHP.NoSilencedErrors - return function_exists('posix_isatty') && @posix_isatty(STDOUT); - } - } - - /** - * @codeCoverageIgnore - * - * @return bool - */ - public function are256ColorsSupported() - { - if (DIRECTORY_SEPARATOR === '\\') { - // phpcs:ignore Generic.PHP.NoSilencedErrors,PHPCompatibility.FunctionUse.NewFunctions.sapi_windows_vt100_supportFound - return function_exists('sapi_windows_vt100_support') && @sapi_windows_vt100_support(STDOUT); - } else { - return strpos(getenv('TERM'), '256color') !== false; - } - } - - /** - * @return array - */ - public function getPossibleStyles() - { - return array_keys($this->styles); - } - - /** - * @param string $name - * @return string[] - */ - private function themeSequence($name) - { - $sequences = []; - foreach ($this->themes[$name] as $style) { - $sequences[] = $this->styleSequence($style); - } - - return $sequences; + rmdir($dir); } - - /** - * @param string $style - * @return string - */ - private function styleSequence($style) - { - if (array_key_exists($style, $this->styles)) { - return $this->styles[$style]; - } - - if (! $this->are256ColorsSupported()) { - return null; - } - - preg_match(self::COLOR256_REGEXP, $style, $matches); - - $type = $matches[1] === 'bg_' ? self::BACKGROUND : self::FOREGROUND; - $value = $matches[2]; - - return "$type;5;$value"; - } - - /** - * @param string $style - * @return bool - */ - private function isValidStyle($style) - { - return array_key_exists($style, $this->styles) || preg_match(self::COLOR256_REGEXP, $style); - } - - /** - * @param string|int $value - * @return string - */ - private function escSequence($value) - { - return "\033[{$value}m"; - } -} +} \ No newline at end of file