Elgg\Notifications\Notification::__construct PHP Method

__construct() public method

Create a notification
public __construct ( ElggEntity $from, ElggEntity $to, string $language, string $subject, string $body, string $summary = '', array $params = [] )
$from ElggEntity The entity sending the notification (usually the site)
$to ElggEntity The entity receiving the notification
$language string The language code for the notification
$subject string The subject of the notification
$body string The body of the notification
$summary string Optional summary of the notification
$params array Optional array of parameters
    public function __construct(\ElggEntity $from, \ElggEntity $to, $language, $subject, $body, $summary = '', array $params = array())
    {
        if (!$from) {
            throw new \InvalidArgumentException('$from is not a valid \\ElggEntity');
        }
        if (!$to) {
            throw new \InvalidArgumentException('$to is not a valid \\ElggEntity');
        }
        $this->from = $from;
        $this->to = $to;
        $this->language = $language;
        $this->subject = $subject;
        $this->body = $body;
        $this->summary = $summary;
        $this->params = $params;
    }