[TASK] MailUtility: Add function extractByType
This commit is contained in:
parent
599dc81f7a
commit
94a7c42289
@ -128,6 +128,28 @@ class MailUtility
|
|||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets row from content by given type
|
||||||
|
*
|
||||||
|
* @param array $content the mail content
|
||||||
|
* @param string $type the type to search
|
||||||
|
*/
|
||||||
|
public static function extractByType($content, $type)
|
||||||
|
{
|
||||||
|
$elementPosition = array_search(
|
||||||
|
$type,
|
||||||
|
array_column($content, 'type')
|
||||||
|
);
|
||||||
|
if (!$elementPosition === false) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!array_key_exists('data', $content[$elementPosition])) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
return $content[$elementPosition]['data'];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* tages maildata, builds html and text mails an decides where to send them
|
* tages maildata, builds html and text mails an decides where to send them
|
||||||
* allows to intercept sender for testing
|
* allows to intercept sender for testing
|
||||||
|
Loading…
x
Reference in New Issue
Block a user