mirror of
https://github.com/friendica/friendica
synced 2025-04-28 11:44:23 +02:00
Fix invalid "emailer_prepare" Hook
- Use IEmail instead of array data - Introduce "composer" based library for phpmailer
This commit is contained in:
parent
db9f75fbdb
commit
f6aea0d65a
3 changed files with 24 additions and 5 deletions
|
@ -132,4 +132,25 @@ class Email implements IEmail
|
|||
|
||||
return $newEmail;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new Email instance based on a given prototype
|
||||
*
|
||||
* @param static $prototype The base prototype
|
||||
* @param array $data The delta-data (key must be an existing property)
|
||||
*
|
||||
* @return static The new email instance
|
||||
*/
|
||||
public static function createFromPrototype(Email $prototype, array $data = [])
|
||||
{
|
||||
$newMail = clone $prototype;
|
||||
|
||||
foreach ($data as $key => $value) {
|
||||
if (property_exists($newMail, $key)) {
|
||||
$newMail->{$key} = $value;
|
||||
}
|
||||
}
|
||||
|
||||
return $newMail;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue