1 | <?php |
||
24 | class GelfMessageToStringFormatter implements FormatterInterface |
||
25 | { |
||
26 | /** |
||
27 | * @param GelfMessageFormatter $formatter |
||
28 | */ |
||
29 | public function __construct(GelfMessageFormatter $formatter) |
||
33 | |||
34 | /** |
||
35 | * {@inheritdoc} the gelf message is an array which cannot be logged into a single line |
||
36 | * By jsonencoding the message we can write it on a single line |
||
37 | */ |
||
38 | public function format(array $record) |
||
47 | |||
48 | /** |
||
49 | * Formats a set of log records. |
||
50 | * |
||
51 | * @param array $records A set of records to format |
||
52 | * @return mixed The formatted set of records |
||
53 | */ |
||
54 | public function formatBatch(array $records) |
||
58 | } |
||
59 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: