OutputInterface.php 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  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 $newline Whether to add a newline
  31. * @param $options A bitmask of options (one of the OUTPUT or VERBOSITY constants), 0 is considered the same as self::OUTPUT_NORMAL | self::VERBOSITY_NORMAL
  32. */
  33. public function write(string|iterable $messages, bool $newline = false, int $options = 0);
  34. /**
  35. * Writes a message to the output and adds a newline at the end.
  36. *
  37. * @param $options A bitmask of options (one of the OUTPUT or VERBOSITY constants), 0 is considered the same as self::OUTPUT_NORMAL | self::VERBOSITY_NORMAL
  38. */
  39. public function writeln(string|iterable $messages, int $options = 0);
  40. /**
  41. * Sets the verbosity of the output.
  42. */
  43. public function setVerbosity(int $level);
  44. /**
  45. * Gets the current verbosity of the output.
  46. */
  47. public function getVerbosity(): int;
  48. /**
  49. * Returns whether verbosity is quiet (-q).
  50. */
  51. public function isQuiet(): bool;
  52. /**
  53. * Returns whether verbosity is verbose (-v).
  54. */
  55. public function isVerbose(): bool;
  56. /**
  57. * Returns whether verbosity is very verbose (-vv).
  58. */
  59. public function isVeryVerbose(): bool;
  60. /**
  61. * Returns whether verbosity is debug (-vvv).
  62. */
  63. public function isDebug(): bool;
  64. /**
  65. * Sets the decorated flag.
  66. */
  67. public function setDecorated(bool $decorated);
  68. /**
  69. * Gets the decorated flag.
  70. */
  71. public function isDecorated(): bool;
  72. public function setFormatter(OutputFormatterInterface $formatter);
  73. /**
  74. * Returns current output formatter instance.
  75. */
  76. public function getFormatter(): OutputFormatterInterface;
  77. }