OutputFormatterInterface.php 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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. * @api
  17. */
  18. interface OutputFormatterInterface
  19. {
  20. /**
  21. * Sets the decorated flag.
  22. *
  23. * @param bool $decorated Whether to decorate the messages or not
  24. *
  25. * @api
  26. */
  27. public function setDecorated($decorated);
  28. /**
  29. * Gets the decorated flag.
  30. *
  31. * @return bool true if the output will decorate messages, false otherwise
  32. *
  33. * @api
  34. */
  35. public function isDecorated();
  36. /**
  37. * Sets a new style.
  38. *
  39. * @param string $name The style name
  40. * @param OutputFormatterStyleInterface $style The style instance
  41. *
  42. * @api
  43. */
  44. public function setStyle($name, OutputFormatterStyleInterface $style);
  45. /**
  46. * Checks if output formatter has style with specified name.
  47. *
  48. * @param string $name
  49. *
  50. * @return bool
  51. *
  52. * @api
  53. */
  54. public function hasStyle($name);
  55. /**
  56. * Gets style options from style with specified name.
  57. *
  58. * @param string $name
  59. *
  60. * @return OutputFormatterStyleInterface
  61. *
  62. * @api
  63. */
  64. public function getStyle($name);
  65. /**
  66. * Formats a message according to the given styles.
  67. *
  68. * @param string $message The message to style
  69. *
  70. * @return string The styled message
  71. *
  72. * @api
  73. */
  74. public function format($message);
  75. }