StyleInterface.php 3.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  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. public function listing(array $elements);
  34. /**
  35. * Formats informational text.
  36. *
  37. * @param string|array $message
  38. */
  39. public function text($message);
  40. /**
  41. * Formats a success result bar.
  42. *
  43. * @param string|array $message
  44. */
  45. public function success($message);
  46. /**
  47. * Formats an error result bar.
  48. *
  49. * @param string|array $message
  50. */
  51. public function error($message);
  52. /**
  53. * Formats an warning result bar.
  54. *
  55. * @param string|array $message
  56. */
  57. public function warning($message);
  58. /**
  59. * Formats a note admonition.
  60. *
  61. * @param string|array $message
  62. */
  63. public function note($message);
  64. /**
  65. * Formats a caution admonition.
  66. *
  67. * @param string|array $message
  68. */
  69. public function caution($message);
  70. /**
  71. * Formats a table.
  72. */
  73. public function table(array $headers, array $rows);
  74. /**
  75. * Asks a question.
  76. *
  77. * @param string $question
  78. * @param string|null $default
  79. * @param callable|null $validator
  80. *
  81. * @return mixed
  82. */
  83. public function ask($question, $default = null, $validator = null);
  84. /**
  85. * Asks a question with the user input hidden.
  86. *
  87. * @param string $question
  88. * @param callable|null $validator
  89. *
  90. * @return mixed
  91. */
  92. public function askHidden($question, $validator = null);
  93. /**
  94. * Asks for confirmation.
  95. *
  96. * @param string $question
  97. * @param bool $default
  98. *
  99. * @return bool
  100. */
  101. public function confirm($question, $default = true);
  102. /**
  103. * Asks a choice question.
  104. *
  105. * @param string $question
  106. * @param array $choices
  107. * @param string|int|null $default
  108. *
  109. * @return mixed
  110. */
  111. public function choice($question, array $choices, $default = null);
  112. /**
  113. * Add newline(s).
  114. *
  115. * @param int $count The number of newlines
  116. */
  117. public function newLine($count = 1);
  118. /**
  119. * Starts the progress output.
  120. *
  121. * @param int $max Maximum steps (0 if unknown)
  122. */
  123. public function progressStart($max = 0);
  124. /**
  125. * Advances the progress output X steps.
  126. *
  127. * @param int $step Number of steps to advance
  128. */
  129. public function progressAdvance($step = 1);
  130. /**
  131. * Finishes the progress output.
  132. */
  133. public function progressFinish();
  134. }