OutputFormatterInterface.php 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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. }