OutputFormatterInterface.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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. * Whether the output will decorate messages.
  24. *
  25. * @return bool
  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. * @return string|null
  50. */
  51. public function format(?string $message);
  52. }