OutputFormatterInterface.php 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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);
  22. /**
  23. * Gets the decorated flag.
  24. *
  25. * @return bool true if the output will decorate messages, false otherwise
  26. */
  27. public function isDecorated();
  28. /**
  29. * Sets a new style.
  30. */
  31. public function setStyle(string $name, OutputFormatterStyleInterface $style);
  32. /**
  33. * Checks if output formatter has style with specified name.
  34. *
  35. * @return bool
  36. */
  37. public function hasStyle(string $name);
  38. /**
  39. * Gets style options from style with specified name.
  40. *
  41. * @return OutputFormatterStyleInterface
  42. *
  43. * @throws \InvalidArgumentException When style isn't defined
  44. */
  45. public function getStyle(string $name);
  46. /**
  47. * Formats a message according to the given styles.
  48. */
  49. public function format(?string $message);
  50. }