StyleInterface.php 2.4 KB

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