NullOutput.php 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  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. * @api
  22. */
  23. class NullOutput implements OutputInterface
  24. {
  25. /**
  26. * {@inheritdoc}
  27. */
  28. public function setFormatter(OutputFormatterInterface $formatter)
  29. {
  30. // do nothing
  31. }
  32. /**
  33. * {@inheritdoc}
  34. */
  35. public function getFormatter()
  36. {
  37. // to comply with the interface we must return a OutputFormatterInterface
  38. return new OutputFormatter();
  39. }
  40. /**
  41. * {@inheritdoc}
  42. */
  43. public function setDecorated($decorated)
  44. {
  45. // do nothing
  46. }
  47. /**
  48. * {@inheritdoc}
  49. */
  50. public function isDecorated()
  51. {
  52. return false;
  53. }
  54. /**
  55. * {@inheritdoc}
  56. */
  57. public function setVerbosity($level)
  58. {
  59. // do nothing
  60. }
  61. /**
  62. * {@inheritdoc}
  63. */
  64. public function getVerbosity()
  65. {
  66. return self::VERBOSITY_QUIET;
  67. }
  68. public function isQuiet()
  69. {
  70. return true;
  71. }
  72. public function isVerbose()
  73. {
  74. return false;
  75. }
  76. public function isVeryVerbose()
  77. {
  78. return false;
  79. }
  80. public function isDebug()
  81. {
  82. return false;
  83. }
  84. /**
  85. * {@inheritdoc}
  86. */
  87. public function writeln($messages, $type = self::OUTPUT_NORMAL)
  88. {
  89. // do nothing
  90. }
  91. /**
  92. * {@inheritdoc}
  93. */
  94. public function write($messages, $newline = false, $type = self::OUTPUT_NORMAL)
  95. {
  96. // do nothing
  97. }
  98. }