MCPcopy Create free account
hub / github.com/Rello/analytics / setParsedSubjectFromRichSubject

Method setParsedSubjectFromRichSubject

lib/Notification/Notifier.php:156–169  ·  view source on GitHub ↗

This is a little helper function which automatically sets the simple parsed subject based on the rich subject you set.

(INotification $notification)

Source from the content-addressed store, hash-verified

154 // This is a little helper function which automatically sets the simple parsed subject
155 // based on the rich subject you set.
156 protected function setParsedSubjectFromRichSubject(INotification $notification)
157 {
158 $placeholders = $replacements = [];
159 foreach ($notification->getRichSubjectParameters() as $placeholder => $parameter) {
160 $placeholders[] = '{' . $placeholder . '}';
161 if ($parameter['type'] === 'file') {
162 $replacements[] = $parameter['path'];
163 } else {
164 $replacements[] = $parameter['name'];
165 }
166 }
167
168 $notification->setParsedSubject(str_replace($placeholders, $replacements, $notification->getRichSubject()));
169 }
170
171}

Callers 1

prepareMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected