blessing-skin-server/app/Events/RenderingHeader.php

38 lines
708 B
PHP
Raw Normal View History

<?php
namespace App\Events;
class RenderingHeader extends Event
{
public $contents;
/**
* Create a new event instance.
*
2018-02-16 16:25:35 +08:00
* @param array $contents
* @return void
*/
public function __construct(array &$contents)
{
2018-02-16 16:25:35 +08:00
// Pass array by reference
$this->contents = &$contents;
}
2018-02-16 16:25:35 +08:00
/**
* Add content to page footer.
*
* @param string $content
* @return void
*/
public function addContent($content)
{
if ($content) {
2018-02-16 16:25:35 +08:00
if (! is_string($content)) {
throw new \Exception("Can not add non-string content", 1);
}
$this->contents[] = $content;
}
}
}