Note.php 588 B

12345678910111213141516171819202122232425262728293031323334
  1. <?php
  2. namespace Dcat\Admin\Extend;
  3. use Symfony\Component\Console\Output\OutputInterface;
  4. trait Note
  5. {
  6. /**
  7. * @var \Symfony\Component\Console\Output\OutputInterface
  8. */
  9. public $output;
  10. /**
  11. * @var array
  12. */
  13. public $notes = [];
  14. public function note($message)
  15. {
  16. if ($this->output instanceof OutputInterface) {
  17. $this->output->writeln($message);
  18. } else {
  19. $this->notes[] = $message;
  20. }
  21. }
  22. public function setOutPut($output)
  23. {
  24. $this->output = $output;
  25. return $this;
  26. }
  27. }