StyleInterface.php 2.7 KB

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