for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* @copyright Copyright (c) Flipbox Digital Limited
* @license https://github.com/flipboxfactory/craft-ember/blob/master/LICENSE
* @link https://github.com/flipboxfactory/craft-ember/
*/
namespace flipbox\craft\ember\queue;
use Craft;
use craft\elements\User;
use craft\helpers\ArrayHelper;
* @author Flipbox Factory <[email protected]>
* @since 2.3.2
class EmailByKey extends AbstractEmailByKey implements \Serializable
{
* The email key
*
* @var string
public $key;
* The recipients
* @var array
protected $recipients = [];
* The email params
protected $params;
* @inheritdoc
public function getKey(): string
return $this->key;
}
public function getRecipients(): array
return $this->recipients;
* @param array $recipients
* @return $this
public function setRecipients(array $recipients)
foreach ($recipients as $recipient) {
$this->addRecipient($recipient);
return $this;
* @param $recipient
public function addRecipient($recipient)
if ($recipient instanceof User) {
$recipient = [$recipient->email];
$this->recipients[] = $recipient;
public function getParams(): array
return $this->params;
* @param $params
public function setParams($params)
$this->params = ArrayHelper::toArray($params);
public function serialize()
return serialize([
'key' => $this->key,
'recipients' => $this->recipients,
'params' => $this->params
]);
public function unserialize($serialized)
Craft::configure(
$this,
unserialize($serialized)
);