NullIO.php 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. <?php
  2. /*
  3. * This file is part of Composer.
  4. *
  5. * (c) Nils Adermann <naderman@naderman.de>
  6. * Jordi Boggiano <j.boggiano@seld.be>
  7. *
  8. * For the full copyright and license information, please view the LICENSE
  9. * file that was distributed with this source code.
  10. */
  11. namespace Composer\IO;
  12. /**
  13. * IOInterface that is not interactive and never writes the output
  14. *
  15. * @author Christophe Coevoet <stof@notk.org>
  16. */
  17. class NullIO implements IOInterface
  18. {
  19. /**
  20. * {@inheritDoc}
  21. */
  22. public function isInteractive()
  23. {
  24. return false;
  25. }
  26. /**
  27. * {@inheritDoc}
  28. */
  29. public function isVerbose()
  30. {
  31. return false;
  32. }
  33. /**
  34. * {@inheritDoc}
  35. */
  36. public function isDecorated()
  37. {
  38. return false;
  39. }
  40. /**
  41. * {@inheritDoc}
  42. */
  43. public function write($messages, $newline = true)
  44. {
  45. }
  46. /**
  47. * {@inheritDoc}
  48. */
  49. public function overwrite($messages, $newline = true, $size = 80)
  50. {
  51. }
  52. /**
  53. * {@inheritDoc}
  54. */
  55. public function ask($question, $default = null)
  56. {
  57. return $default;
  58. }
  59. /**
  60. * {@inheritDoc}
  61. */
  62. public function askConfirmation($question, $default = true)
  63. {
  64. return $default;
  65. }
  66. /**
  67. * {@inheritDoc}
  68. */
  69. public function askAndValidate($question, $validator, $attempts = false, $default = null)
  70. {
  71. return $default;
  72. }
  73. /**
  74. * {@inheritDoc}
  75. */
  76. public function askAndHideAnswer($question)
  77. {
  78. return null;
  79. }
  80. /**
  81. * {@inheritDoc}
  82. */
  83. public function getLastUsername()
  84. {
  85. return null;
  86. }
  87. /**
  88. * {@inheritDoc}
  89. */
  90. public function getLastPassword()
  91. {
  92. return null;
  93. }
  94. /**
  95. * {@inheritDoc}
  96. */
  97. public function getAuthorizations()
  98. {
  99. return array();
  100. }
  101. /**
  102. * {@inheritDoc}
  103. */
  104. public function hasAuthorization($repositoryName)
  105. {
  106. return false;
  107. }
  108. /**
  109. * {@inheritDoc}
  110. */
  111. public function getAuthorization($repositoryName)
  112. {
  113. return array('username' => null, 'password' => null);
  114. }
  115. /**
  116. * {@inheritDoc}
  117. */
  118. public function setAuthorization($repositoryName, $username, $password = null)
  119. {
  120. }
  121. }