OutputInterface.php 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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. const VERBOSITY_QUIET = 16;
  20. const VERBOSITY_NORMAL = 32;
  21. const VERBOSITY_VERBOSE = 64;
  22. const VERBOSITY_VERY_VERBOSE = 128;
  23. const VERBOSITY_DEBUG = 256;
  24. const OUTPUT_NORMAL = 1;
  25. const OUTPUT_RAW = 2;
  26. const OUTPUT_PLAIN = 4;
  27. /**
  28. * Writes a message to the output.
  29. *
  30. * @param string|array $messages The message as an array of lines 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|array $messages The message as an array of lines of 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. * Sets the decorated flag.
  56. *
  57. * @param bool $decorated Whether to decorate the messages
  58. */
  59. public function setDecorated($decorated);
  60. /**
  61. * Gets the decorated flag.
  62. *
  63. * @return bool true if the output will decorate messages, false otherwise
  64. */
  65. public function isDecorated();
  66. public function setFormatter(OutputFormatterInterface $formatter);
  67. /**
  68. * Returns current output formatter instance.
  69. *
  70. * @return OutputFormatterInterface
  71. */
  72. public function getFormatter();
  73. }