NullOutput.php 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  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\OutputFormatter;
  12. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  13. /**
  14. * NullOutput suppresses all output.
  15. *
  16. * $output = new NullOutput();
  17. *
  18. * @author Fabien Potencier <fabien@symfony.com>
  19. * @author Tobias Schultze <http://tobion.de>
  20. */
  21. class NullOutput implements OutputInterface
  22. {
  23. /**
  24. * {@inheritdoc}
  25. */
  26. public function setFormatter(OutputFormatterInterface $formatter)
  27. {
  28. // do nothing
  29. }
  30. /**
  31. * {@inheritdoc}
  32. */
  33. public function getFormatter()
  34. {
  35. // to comply with the interface we must return a OutputFormatterInterface
  36. return new OutputFormatter();
  37. }
  38. /**
  39. * {@inheritdoc}
  40. */
  41. public function setDecorated($decorated)
  42. {
  43. // do nothing
  44. }
  45. /**
  46. * {@inheritdoc}
  47. */
  48. public function isDecorated()
  49. {
  50. return false;
  51. }
  52. /**
  53. * {@inheritdoc}
  54. */
  55. public function setVerbosity($level)
  56. {
  57. // do nothing
  58. }
  59. /**
  60. * {@inheritdoc}
  61. */
  62. public function getVerbosity()
  63. {
  64. return self::VERBOSITY_QUIET;
  65. }
  66. /**
  67. * {@inheritdoc}
  68. */
  69. public function isQuiet()
  70. {
  71. return true;
  72. }
  73. /**
  74. * {@inheritdoc}
  75. */
  76. public function isVerbose()
  77. {
  78. return false;
  79. }
  80. /**
  81. * {@inheritdoc}
  82. */
  83. public function isVeryVerbose()
  84. {
  85. return false;
  86. }
  87. /**
  88. * {@inheritdoc}
  89. */
  90. public function isDebug()
  91. {
  92. return false;
  93. }
  94. /**
  95. * {@inheritdoc}
  96. */
  97. public function writeln($messages, $options = self::OUTPUT_NORMAL)
  98. {
  99. // do nothing
  100. }
  101. /**
  102. * {@inheritdoc}
  103. */
  104. public function write($messages, $newline = false, $options = self::OUTPUT_NORMAL)
  105. {
  106. // do nothing
  107. }
  108. }