PluginProbe ʕ •ᴥ•ʔ
Matomo Analytics – Powerful, Privacy-First Insights for WordPress / 5.8.2
Matomo Analytics – Powerful, Privacy-First Insights for WordPress v5.8.2
5.11.1 5.11.0 5.10.2 5.10.1 trunk 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.1.0 1.1.1 1.1.2 1.1.3 1.2.0 1.3.0 1.3.1 1.3.2 4.0.0 4.0.1 4.0.2 4.0.3 4.0.4 4.1.0 4.1.1 4.1.2 4.1.3 4.10.0 4.11.0 4.12.0 4.13.0 4.13.2 4.13.3 4.13.4 4.13.5 4.14.0 4.14.1 4.14.2 4.15.0 4.15.1 4.15.2 4.15.3 4.2.0 4.3.0 4.3.1 4.4.1 4.4.2 4.5.0 4.6.0 5.0.1 5.0.2 5.0.3 5.0.4 5.0.5 5.0.6 5.0.7 5.0.8 5.1.0 5.1.1 5.1.2 5.1.3 5.1.4 5.1.5 5.1.6 5.1.7 5.10.0 5.2.0 5.2.1 5.2.2 5.3.0 5.3.1 5.3.2 5.3.3 5.6.0 5.6.1 5.7.0 5.7.1 5.8.0 5.8.1 5.8.2
matomo / app / vendor / prefixed / symfony / console / Formatter / OutputFormatterStyle.php
matomo / app / vendor / prefixed / symfony / console / Formatter Last commit date
NullOutputFormatter.php 1 year ago NullOutputFormatterStyle.php 2 years ago OutputFormatter.php 1 year ago OutputFormatterInterface.php 2 years ago OutputFormatterStyle.php 1 year ago OutputFormatterStyleInterface.php 2 years ago OutputFormatterStyleStack.php 1 year ago WrappableOutputFormatterInterface.php 2 years ago
OutputFormatterStyle.php
95 lines
1 <?php
2
3 /*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11 namespace Matomo\Dependencies\Symfony\Component\Console\Formatter;
12
13 use Matomo\Dependencies\Symfony\Component\Console\Color;
14 /**
15 * Formatter style class for defining styles.
16 *
17 * @author Konstantin Kudryashov <ever.zet@gmail.com>
18 */
19 class OutputFormatterStyle implements OutputFormatterStyleInterface
20 {
21 private $color;
22 private $foreground;
23 private $background;
24 private $options;
25 private $href;
26 private $handlesHrefGracefully;
27 /**
28 * Initializes output formatter style.
29 *
30 * @param string|null $foreground The style foreground color name
31 * @param string|null $background The style background color name
32 */
33 public function __construct(?string $foreground = null, ?string $background = null, array $options = [])
34 {
35 $this->color = new Color($this->foreground = $foreground ?: '', $this->background = $background ?: '', $this->options = $options);
36 }
37 /**
38 * {@inheritdoc}
39 */
40 public function setForeground(?string $color = null)
41 {
42 $this->color = new Color($this->foreground = $color ?: '', $this->background, $this->options);
43 }
44 /**
45 * {@inheritdoc}
46 */
47 public function setBackground(?string $color = null)
48 {
49 $this->color = new Color($this->foreground, $this->background = $color ?: '', $this->options);
50 }
51 public function setHref(string $url) : void
52 {
53 $this->href = $url;
54 }
55 /**
56 * {@inheritdoc}
57 */
58 public function setOption(string $option)
59 {
60 $this->options[] = $option;
61 $this->color = new Color($this->foreground, $this->background, $this->options);
62 }
63 /**
64 * {@inheritdoc}
65 */
66 public function unsetOption(string $option)
67 {
68 $pos = array_search($option, $this->options);
69 if (\false !== $pos) {
70 unset($this->options[$pos]);
71 }
72 $this->color = new Color($this->foreground, $this->background, $this->options);
73 }
74 /**
75 * {@inheritdoc}
76 */
77 public function setOptions(array $options)
78 {
79 $this->color = new Color($this->foreground, $this->background, $this->options = $options);
80 }
81 /**
82 * {@inheritdoc}
83 */
84 public function apply(string $text)
85 {
86 if (null === $this->handlesHrefGracefully) {
87 $this->handlesHrefGracefully = 'JetBrains-JediTerm' !== getenv('TERMINAL_EMULATOR') && (!getenv('KONSOLE_VERSION') || (int) getenv('KONSOLE_VERSION') > 201100) && !isset($_SERVER['IDEA_INITIAL_DIRECTORY']);
88 }
89 if (null !== $this->href && $this->handlesHrefGracefully) {
90 $text = "\x1b]8;;{$this->href}\x1b\\{$text}\x1b]8;;\x1b\\";
91 }
92 return $this->color->apply($text);
93 }
94 }
95