OutputInterface.php 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  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\Output;
  11. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  12. /**
  13. * OutputInterface is the interface implemented by all Output classes.
  14. *
  15. * @author Fabien Potencier <fabien@symfony.com>
  16. *
  17. * @api
  18. */
  19. interface OutputInterface
  20. {
  21. const VERBOSITY_QUIET = 0;
  22. const VERBOSITY_NORMAL = 1;
  23. const VERBOSITY_VERBOSE = 2;
  24. const OUTPUT_NORMAL = 0;
  25. const OUTPUT_RAW = 1;
  26. const OUTPUT_PLAIN = 2;
  27. /**
  28. * Writes a message to the output.
  29. *
  30. * @param string|array $messages The message as an array of lines of a single string
  31. * @param Boolean $newline Whether to add a newline or not
  32. * @param integer $type The type of output
  33. *
  34. * @throws \InvalidArgumentException When unknown output type is given
  35. *
  36. * @api
  37. */
  38. function write($messages, $newline = false, $type = 0);
  39. /**
  40. * Writes a message to the output and adds a newline at the end.
  41. *
  42. * @param string|array $messages The message as an array of lines of a single string
  43. * @param integer $type The type of output
  44. *
  45. * @api
  46. */
  47. function writeln($messages, $type = 0);
  48. /**
  49. * Sets the verbosity of the output.
  50. *
  51. * @param integer $level The level of verbosity
  52. *
  53. * @api
  54. */
  55. function setVerbosity($level);
  56. /**
  57. * Gets the current verbosity of the output.
  58. *
  59. * @return integer The current level of verbosity
  60. *
  61. * @api
  62. */
  63. function getVerbosity();
  64. /**
  65. * Sets the decorated flag.
  66. *
  67. * @param Boolean $decorated Whether to decorate the messages or not
  68. *
  69. * @api
  70. */
  71. function setDecorated($decorated);
  72. /**
  73. * Gets the decorated flag.
  74. *
  75. * @return Boolean true if the output will decorate messages, false otherwise
  76. *
  77. * @api
  78. */
  79. function isDecorated();
  80. /**
  81. * Sets output formatter.
  82. *
  83. * @param OutputFormatterInterface $formatter
  84. *
  85. * @api
  86. */
  87. function setFormatter(OutputFormatterInterface $formatter);
  88. /**
  89. * Returns current output formatter instance.
  90. *
  91. * @return OutputFormatterInterface
  92. *
  93. * @api
  94. */
  95. function getFormatter();
  96. }