OutputFormatterInterface.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <fabien@symfony.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Symfony\Component\Console\Formatter;
  11. /**
  12. * Formatter interface for console output.
  13. *
  14. * @author Konstantin Kudryashov <ever.zet@gmail.com>
  15. */
  16. interface OutputFormatterInterface
  17. {
  18. /**
  19. * Sets the decorated flag.
  20. */
  21. public function setDecorated(bool $decorated): void;
  22. /**
  23. * Whether the output will decorate messages.
  24. */
  25. public function isDecorated(): bool;
  26. /**
  27. * Sets a new style.
  28. */
  29. public function setStyle(string $name, OutputFormatterStyleInterface $style): void;
  30. /**
  31. * Checks if output formatter has style with specified name.
  32. */
  33. public function hasStyle(string $name): bool;
  34. /**
  35. * Gets style options from style with specified name.
  36. *
  37. * @throws \InvalidArgumentException When style isn't defined
  38. */
  39. public function getStyle(string $name): OutputFormatterStyleInterface;
  40. /**
  41. * Formats a message according to the given styles.
  42. */
  43. public function format(?string $message): ?string;
  44. }