NullOutput.php 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  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. /**
  69. * {@inheritdoc}
  70. */
  71. public function writeln($messages, $type = self::OUTPUT_NORMAL)
  72. {
  73. // do nothing
  74. }
  75. /**
  76. * {@inheritdoc}
  77. */
  78. public function write($messages, $newline = false, $type = self::OUTPUT_NORMAL)
  79. {
  80. // do nothing
  81. }
  82. }