RenderingFooter.php 577 B

123456789101112131415161718192021222324252627282930
  1. <?php
  2. namespace app\common\events;
  3. class RenderingFooter extends Event
  4. {
  5. protected $contents;
  6. /**
  7. * Create a new event instance.
  8. *
  9. * @return void
  10. */
  11. public function __construct(array &$contents)
  12. {
  13. // pass array by reference
  14. $this->contents = &$contents;
  15. }
  16. public function addContent($content)
  17. {
  18. if ($content) {
  19. if (!is_string($content)) {
  20. throw new \Exception("Can not add non-string content", 1);
  21. }
  22. $this->contents[] = $content;
  23. }
  24. }
  25. }