RenderingHeader.php 623 B

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. namespace app\common\events;
  3. class RenderingHeader extends Event
  4. {
  5. public $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. protected function setPrice()
  17. {
  18. }
  19. public function addContent($content)
  20. {
  21. if ($content) {
  22. if (!is_string($content)) {
  23. throw new \Exception("Can not add non-string content", 1);
  24. }
  25. $this->contents[] = $content;
  26. }
  27. }
  28. }