|
@@ -20,16 +20,19 @@ use Symfony\Components\DependencyInjection\ContainerInterface;
|
|
|
*/
|
|
|
class ExceptionFormatter
|
|
|
{
|
|
|
- protected $container;
|
|
|
+ protected $fileLinkFormat;
|
|
|
+ protected $charset;
|
|
|
|
|
|
/**
|
|
|
* Constructor.
|
|
|
*
|
|
|
- * @param ContainerInterface $container A Container instance
|
|
|
+ * @param string $fileLinkFormat The format for links to source files
|
|
|
+ * @param string $charset The current charset
|
|
|
*/
|
|
|
- public function __construct(ContainerInterface $container)
|
|
|
+ public function __construct($fileLinkFormat, $charset = 'UTF-8')
|
|
|
{
|
|
|
- $this->container = $container;
|
|
|
+ $this->fileLinkFormat = null !== $fileLinkFormat ? $fileLinkFormat : ini_get('xdebug.file_link_format');
|
|
|
+ $this->charset = $charset;
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -150,9 +153,8 @@ class ExceptionFormatter
|
|
|
$text = $file;
|
|
|
}
|
|
|
|
|
|
- $linkFormat = $this->container->getParameterBag()->has('debug.file_link_format') ? $this->container->getParameter('debug.file_link_format') : ini_get('xdebug.file_link_format');
|
|
|
- if ('html' === $format && $file && $line && $linkFormat) {
|
|
|
- $link = strtr($linkFormat, array('%f' => $file, '%l' => $line));
|
|
|
+ if ('html' === $format && $file && $line && $this->fileLinkFormat) {
|
|
|
+ $link = strtr($this->fileLinkFormat, array('%f' => $file, '%l' => $line));
|
|
|
$text = sprintf('<a href="%s" title="Click to open this file" class="file_link">%s</a>', $link, $text);
|
|
|
}
|
|
|
|
|
@@ -172,6 +174,6 @@ class ExceptionFormatter
|
|
|
return $value;
|
|
|
}
|
|
|
|
|
|
- return htmlspecialchars($value, ENT_QUOTES, $this->container->getParameter('kernel.charset'));
|
|
|
+ return htmlspecialchars($value, ENT_QUOTES, $this->charset);
|
|
|
}
|
|
|
}
|