OutputContext.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php
  2. declare(strict_types=1);
  3. /*
  4. * This file is part of PHP CS Fixer.
  5. *
  6. * (c) Fabien Potencier <fabien@symfony.com>
  7. * Dariusz Rumiński <dariusz.ruminski@gmail.com>
  8. *
  9. * This source file is subject to the MIT license that is bundled
  10. * with this source code in the file LICENSE.
  11. */
  12. namespace PhpCsFixer\Console\Output;
  13. use Symfony\Component\Console\Output\OutputInterface;
  14. /**
  15. * @readonly
  16. *
  17. * @internal
  18. */
  19. final class OutputContext
  20. {
  21. private ?OutputInterface $output;
  22. private int $terminalWidth;
  23. private int $filesCount;
  24. public function __construct(
  25. ?OutputInterface $output,
  26. int $terminalWidth,
  27. int $filesCount
  28. ) {
  29. $this->output = $output;
  30. $this->terminalWidth = $terminalWidth;
  31. $this->filesCount = $filesCount;
  32. }
  33. public function getOutput(): ?OutputInterface
  34. {
  35. return $this->output;
  36. }
  37. public function getTerminalWidth(): int
  38. {
  39. return $this->terminalWidth;
  40. }
  41. public function getFilesCount(): int
  42. {
  43. return $this->filesCount;
  44. }
  45. }