No Description

OutputInterface.php 3.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  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. interface OutputInterface
  18. {
  19. public const VERBOSITY_QUIET = 16;
  20. public const VERBOSITY_NORMAL = 32;
  21. public const VERBOSITY_VERBOSE = 64;
  22. public const VERBOSITY_VERY_VERBOSE = 128;
  23. public const VERBOSITY_DEBUG = 256;
  24. public const OUTPUT_NORMAL = 1;
  25. public const OUTPUT_RAW = 2;
  26. public const OUTPUT_PLAIN = 4;
  27. /**
  28. * Writes a message to the output.
  29. *
  30. * @param string|iterable $messages The message as an iterable of strings or a single string
  31. * @param bool $newline Whether to add a newline
  32. * @param int $options A bitmask of options (one of the OUTPUT or VERBOSITY constants), 0 is considered the same as self::OUTPUT_NORMAL | self::VERBOSITY_NORMAL
  33. */
  34. public function write($messages, $newline = false, $options = 0);
  35. /**
  36. * Writes a message to the output and adds a newline at the end.
  37. *
  38. * @param string|iterable $messages The message as an iterable of strings or a single string
  39. * @param int $options A bitmask of options (one of the OUTPUT or VERBOSITY constants), 0 is considered the same as self::OUTPUT_NORMAL | self::VERBOSITY_NORMAL
  40. */
  41. public function writeln($messages, $options = 0);
  42. /**
  43. * Sets the verbosity of the output.
  44. *
  45. * @param int $level The level of verbosity (one of the VERBOSITY constants)
  46. */
  47. public function setVerbosity($level);
  48. /**
  49. * Gets the current verbosity of the output.
  50. *
  51. * @return int The current level of verbosity (one of the VERBOSITY constants)
  52. */
  53. public function getVerbosity();
  54. /**
  55. * Returns whether verbosity is quiet (-q).
  56. *
  57. * @return bool true if verbosity is set to VERBOSITY_QUIET, false otherwise
  58. */
  59. public function isQuiet();
  60. /**
  61. * Returns whether verbosity is verbose (-v).
  62. *
  63. * @return bool true if verbosity is set to VERBOSITY_VERBOSE, false otherwise
  64. */
  65. public function isVerbose();
  66. /**
  67. * Returns whether verbosity is very verbose (-vv).
  68. *
  69. * @return bool true if verbosity is set to VERBOSITY_VERY_VERBOSE, false otherwise
  70. */
  71. public function isVeryVerbose();
  72. /**
  73. * Returns whether verbosity is debug (-vvv).
  74. *
  75. * @return bool true if verbosity is set to VERBOSITY_DEBUG, false otherwise
  76. */
  77. public function isDebug();
  78. /**
  79. * Sets the decorated flag.
  80. *
  81. * @param bool $decorated Whether to decorate the messages
  82. */
  83. public function setDecorated($decorated);
  84. /**
  85. * Gets the decorated flag.
  86. *
  87. * @return bool true if the output will decorate messages, false otherwise
  88. */
  89. public function isDecorated();
  90. public function setFormatter(OutputFormatterInterface $formatter);
  91. /**
  92. * Returns current output formatter instance.
  93. *
  94. * @return OutputFormatterInterface
  95. */
  96. public function getFormatter();
  97. }