ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
MailHandler.php
Go to the documentation of this file.
1 <?php
2 
3 /*
4  * This file is part of the Monolog package.
5  *
6  * (c) Jordi Boggiano <j.boggiano@seld.be>
7  *
8  * For the full copyright and license information, please view the LICENSE
9  * file that was distributed with this source code.
10  */
11 
12 namespace Monolog\Handler;
13 
19 abstract class MailHandler extends AbstractProcessingHandler
20 {
24  public function handleBatch(array $records)
25  {
26  $messages = array();
27 
28  foreach ($records as $record) {
29  if ($record['level'] < $this->level) {
30  continue;
31  }
32  $messages[] = $this->processRecord($record);
33  }
34 
35  if (!empty($messages)) {
36  $this->send((string) $this->getFormatter()->formatBatch($messages), $messages);
37  }
38  }
39 
46  abstract protected function send($content, array $records);
47 
51  protected function write(array $record)
52  {
53  $this->send((string) $record['formatted'], array($record));
54  }
55 
56  protected function getHighestRecord(array $records)
57  {
58  $highestRecord = null;
59  foreach ($records as $record) {
60  if ($highestRecord === null || $highestRecord['level'] < $record['level']) {
61  $highestRecord = $record;
62  }
63  }
64 
65  return $highestRecord;
66  }
67 }
write(array $record)
{}
Definition: MailHandler.php:51
getHighestRecord(array $records)
Definition: MailHandler.php:56
Base Handler class providing the Handler structure.
$records
Definition: simple_test.php:22
send($content, array $records)
Send a mail with the given content.
getFormatter()
{Gets the formatter.FormatterInterface}
Create styles array
The data for the language used.
handleBatch(array $records)
{Handles a set of records at once.The records to handle (an array of record arrays)} ...
Definition: MailHandler.php:24
processRecord(array $record)
Processes a record.
$messages
Definition: en-x-test.php:7
Base class for all mail handlers.
Definition: MailHandler.php:19