1 | <?php |
||
31 | class InterpolateProcessor extends ProcessorAbstract |
||
32 | { |
||
33 | /** |
||
34 | * Replace any '{item}' in the messsage with context['item'] value |
||
35 | * |
||
36 | * @see http://www.php-fig.org/psr/psr-3/ |
||
37 | * |
||
38 | * {@inheritDoc} |
||
39 | */ |
||
40 | public function __invoke(LogEntryInterface $logEntry) |
||
52 | |||
53 | /** |
||
54 | * Get placeholders in array |
||
55 | * |
||
56 | * @param string $message |
||
57 | * @return array |
||
58 | * @access protected |
||
59 | */ |
||
60 | protected function getPlaceHolders(/*# string */ $message)/*# : array */ |
||
74 | |||
75 | /** |
||
76 | * Replace with values from the context array |
||
77 | * |
||
78 | * @param string $name |
||
79 | * @param string $placeholder |
||
80 | * @param array &$context |
||
81 | * @return string |
||
82 | * @access protected |
||
83 | */ |
||
84 | protected function replaceWith( |
||
103 | |||
104 | /** |
||
105 | * Get string representation of mixed-typed $data |
||
106 | * |
||
107 | * @param mixed $data |
||
108 | * @return string |
||
109 | * @access protected |
||
110 | */ |
||
111 | protected function getString($data)/*# : string */ |
||
123 | |||
124 | /** |
||
125 | * Get string representation of an object |
||
126 | * |
||
127 | * @param object $object |
||
128 | * @return string |
||
129 | * @access protected |
||
130 | */ |
||
131 | protected function getObjectString($object)/*# : string */ |
||
146 | |||
147 | /** |
||
148 | * Get 'user.name' type of result, only support 2 level |
||
149 | * |
||
150 | * @param string $name |
||
151 | * @param string $placeholder used only if nothing matched |
||
152 | * @param mixed $data |
||
153 | * @return string |
||
154 | * @access protected |
||
155 | */ |
||
156 | protected function getSubPart( |
||
170 | } |
||
171 |