OutputFormatterInterface.php 1.3 KB

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