StyleInterface.php 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  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. public function title(string $message);
  22. /**
  23. * Formats a section title.
  24. */
  25. public function section(string $message);
  26. /**
  27. * Formats a list.
  28. */
  29. public function listing(array $elements);
  30. /**
  31. * Formats informational text.
  32. *
  33. * @param string|array $message
  34. */
  35. public function text($message);
  36. /**
  37. * Formats a success result bar.
  38. *
  39. * @param string|array $message
  40. */
  41. public function success($message);
  42. /**
  43. * Formats an error result bar.
  44. *
  45. * @param string|array $message
  46. */
  47. public function error($message);
  48. /**
  49. * Formats an warning result bar.
  50. *
  51. * @param string|array $message
  52. */
  53. public function warning($message);
  54. /**
  55. * Formats a note admonition.
  56. *
  57. * @param string|array $message
  58. */
  59. public function note($message);
  60. /**
  61. * Formats a caution admonition.
  62. *
  63. * @param string|array $message
  64. */
  65. public function caution($message);
  66. /**
  67. * Formats a table.
  68. */
  69. public function table(array $headers, array $rows);
  70. /**
  71. * Asks a question.
  72. *
  73. * @return mixed
  74. */
  75. public function ask(string $question, ?string $default = null, callable $validator = null);
  76. /**
  77. * Asks a question with the user input hidden.
  78. *
  79. * @return mixed
  80. */
  81. public function askHidden(string $question, callable $validator = null);
  82. /**
  83. * Asks for confirmation.
  84. *
  85. * @return bool
  86. */
  87. public function confirm(string $question, bool $default = true);
  88. /**
  89. * Asks a choice question.
  90. *
  91. * @param string|int|null $default
  92. *
  93. * @return mixed
  94. */
  95. public function choice(string $question, array $choices, $default = null);
  96. /**
  97. * Add newline(s).
  98. */
  99. public function newLine(int $count = 1);
  100. /**
  101. * Starts the progress output.
  102. */
  103. public function progressStart(int $max = 0);
  104. /**
  105. * Advances the progress output X steps.
  106. */
  107. public function progressAdvance(int $step = 1);
  108. /**
  109. * Finishes the progress output.
  110. */
  111. public function progressFinish();
  112. }