/** * Displays the extra piece of information about the exception. * * @internal * @param Exception $exception The exception to process. * @param array $params The extra parameters passed from the port. */ public function display(Exception $exception, array $params) { if (!$exception instanceof Opl_Exception_Stack_Interface) { return; } if (!isset($params['title'])) { return; } $data = $exception->getStackData(); // Reverse the stack to show the deepest parts on top. if ($data instanceof SplStack) { $data->setIteratorMode(SplStack::IT_MODE_LIFO | SplStack::IT_MODE_KEEP); } elseif (is_array($data)) { $data = array_reverse($data); } else { return; } // Display the custom stack echo ' <p class="directive">' . $params['title'] . ":</p>\r\n"; $i = 1; foreach ($data as $item) { if ($i == 1) { echo "\t\t<p class=\"directive\">" . $i . ". <span class=\"bad\">" . $item . "</span></p>\r\n"; } else { echo "\t\t<p class=\"directive\">" . $i . ". <span>" . $item . "</span></p>\r\n"; } $i++; } }