StyleInterface.php 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  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\Style;
  11. /**
  12. * Output style helpers.
  13. *
  14. * @author Kevin Bond <kevinbond@gmail.com>
  15. */
  16. interface StyleInterface
  17. {
  18. /**
  19. * Formats a command title.
  20. *
  21. * @param string $message
  22. */
  23. public function title($message);
  24. /**
  25. * Formats a section title.
  26. *
  27. * @param string $message
  28. */
  29. public function section($message);
  30. /**
  31. * Formats a list.
  32. *
  33. * @param array $elements
  34. */
  35. public function listing(array $elements);
  36. /**
  37. * Formats informational text.
  38. *
  39. * @param string|array $message
  40. */
  41. public function text($message);
  42. /**
  43. * Formats a success result bar.
  44. *
  45. * @param string|array $message
  46. */
  47. public function success($message);
  48. /**
  49. * Formats an error result bar.
  50. *
  51. * @param string|array $message
  52. */
  53. public function error($message);
  54. /**
  55. * Formats an warning result bar.
  56. *
  57. * @param string|array $message
  58. */
  59. public function warning($message);
  60. /**
  61. * Formats a note admonition.
  62. *
  63. * @param string|array $message
  64. */
  65. public function note($message);
  66. /**
  67. * Formats a caution admonition.
  68. *
  69. * @param string|array $message
  70. */
  71. public function caution($message);
  72. /**
  73. * Formats a table.
  74. *
  75. * @param array $headers
  76. * @param array $rows
  77. */
  78. public function table(array $headers, array $rows);
  79. /**
  80. * Asks a question.
  81. *
  82. * @param string $question
  83. * @param string|null $default
  84. * @param callable|null $validator
  85. *
  86. * @return string
  87. */
  88. public function ask($question, $default = null, $validator = null);
  89. /**
  90. * Asks a question with the user input hidden.
  91. *
  92. * @param string $question
  93. * @param callable|null $validator
  94. *
  95. * @return string
  96. */
  97. public function askHidden($question, $validator = null);
  98. /**
  99. * Asks for confirmation.
  100. *
  101. * @param string $question
  102. * @param bool $default
  103. *
  104. * @return bool
  105. */
  106. public function confirm($question, $default = true);
  107. /**
  108. * Asks a choice question.
  109. *
  110. * @param string $question
  111. * @param array $choices
  112. * @param string|int|null $default
  113. *
  114. * @return string
  115. */
  116. public function choice($question, array $choices, $default = null);
  117. /**
  118. * Add newline(s).
  119. *
  120. * @param int $count The number of newlines
  121. */
  122. public function newLine($count = 1);
  123. /**
  124. * Starts the progress output.
  125. *
  126. * @param int $max Maximum steps (0 if unknown)
  127. */
  128. public function progressStart($max = 0);
  129. /**
  130. * Advances the progress output X steps.
  131. *
  132. * @param int $step Number of steps to advance
  133. */
  134. public function progressAdvance($step = 1);
  135. /**
  136. * Finishes the progress output.
  137. */
  138. public function progressFinish();
  139. }