NullOutput.php 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  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. public function isQuiet()
  67. {
  68. return true;
  69. }
  70. public function isVerbose()
  71. {
  72. return false;
  73. }
  74. public function isVeryVerbose()
  75. {
  76. return false;
  77. }
  78. public function isDebug()
  79. {
  80. return false;
  81. }
  82. /**
  83. * {@inheritdoc}
  84. */
  85. public function writeln($messages, $options = self::OUTPUT_NORMAL)
  86. {
  87. // do nothing
  88. }
  89. /**
  90. * {@inheritdoc}
  91. */
  92. public function write($messages, $newline = false, $options = self::OUTPUT_NORMAL)
  93. {
  94. // do nothing
  95. }
  96. }