mirror of
https://github.com/bs-community/blessing-skin-server.git
synced 2024-12-21 06:19:38 +08:00
32 lines
568 B
PHP
32 lines
568 B
PHP
|
<?php
|
||
|
|
||
|
namespace App\Events;
|
||
|
|
||
|
class RenderingHeader extends Event
|
||
|
{
|
||
|
public $contents;
|
||
|
|
||
|
/**
|
||
|
* Create a new event instance.
|
||
|
*
|
||
|
* @return void
|
||
|
*/
|
||
|
public function __construct(array &$contents)
|
||
|
{
|
||
|
// pass array by reference
|
||
|
$this->contents = &$contents;
|
||
|
}
|
||
|
|
||
|
public function addContent($content)
|
||
|
{
|
||
|
if ($content) {
|
||
|
if (!is_string($content)) {
|
||
|
throw new \Exception("Can not add non-string content", 1);
|
||
|
}
|
||
|
|
||
|
$this->contents[] = $content;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
}
|