OutputFormatterInterface.php 1.7 KB

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