Mercurial > hg > isophonics-drupal-site
comparison vendor/symfony/debug/ExceptionHandler.php @ 16:c2387f117808
Routine composer update
author | Chris Cannam |
---|---|
date | Tue, 10 Jul 2018 15:07:59 +0100 |
parents | 7a779792577d |
children | 129ea1e6d783 |
comparison
equal
deleted
inserted
replaced
15:e200cb7efeb3 | 16:c2387f117808 |
---|---|
38 | 38 |
39 public function __construct($debug = true, $charset = null, $fileLinkFormat = null) | 39 public function __construct($debug = true, $charset = null, $fileLinkFormat = null) |
40 { | 40 { |
41 $this->debug = $debug; | 41 $this->debug = $debug; |
42 $this->charset = $charset ?: ini_get('default_charset') ?: 'UTF-8'; | 42 $this->charset = $charset ?: ini_get('default_charset') ?: 'UTF-8'; |
43 $this->fileLinkFormat = $fileLinkFormat ?: ini_get('xdebug.file_link_format') ?: get_cfg_var('xdebug.file_link_format'); | 43 $this->fileLinkFormat = $fileLinkFormat; |
44 } | 44 } |
45 | 45 |
46 /** | 46 /** |
47 * Registers the exception handler. | 47 * Registers the exception handler. |
48 * | 48 * |
353 } | 353 } |
354 | 354 |
355 private function formatPath($path, $line) | 355 private function formatPath($path, $line) |
356 { | 356 { |
357 $file = $this->escapeHtml(preg_match('#[^/\\\\]*+$#', $path, $file) ? $file[0] : $path); | 357 $file = $this->escapeHtml(preg_match('#[^/\\\\]*+$#', $path, $file) ? $file[0] : $path); |
358 $fmt = $this->fileLinkFormat; | 358 $fmt = $this->fileLinkFormat ?: ini_get('xdebug.file_link_format') ?: get_cfg_var('xdebug.file_link_format'); |
359 | 359 |
360 if ($fmt && $link = is_string($fmt) ? strtr($fmt, array('%f' => $path, '%l' => $line)) : $fmt->format($path, $line)) { | 360 if (!$fmt) { |
361 return sprintf('<span class="block trace-file-path">in <a href="%s" title="Go to source">%s (line %d)</a></span>', $this->escapeHtml($link), $file, $line); | 361 return sprintf('<span class="block trace-file-path">in <a title="%s%3$s"><strong>%s</strong>%s</a></span>', $this->escapeHtml($path), $file, 0 < $line ? ' line '.$line : ''); |
362 } | 362 } |
363 | 363 |
364 return sprintf('<span class="block trace-file-path">in <a title="%s line %3$d"><strong>%s</strong> (line %d)</a></span>', $this->escapeHtml($path), $file, $line); | 364 if (\is_string($fmt)) { |
365 $i = strpos($f = $fmt, '&', max(strrpos($f, '%f'), strrpos($f, '%l'))) ?: strlen($f); | |
366 $fmt = array(substr($f, 0, $i)) + preg_split('/&([^>]++)>/', substr($f, $i), -1, PREG_SPLIT_DELIM_CAPTURE); | |
367 | |
368 for ($i = 1; isset($fmt[$i]); ++$i) { | |
369 if (0 === strpos($path, $k = $fmt[$i++])) { | |
370 $path = substr_replace($path, $fmt[$i], 0, strlen($k)); | |
371 break; | |
372 } | |
373 } | |
374 | |
375 $link = strtr($fmt[0], array('%f' => $path, '%l' => $line)); | |
376 } else { | |
377 $link = $fmt->format($path, $line); | |
378 } | |
379 | |
380 return sprintf('<span class="block trace-file-path">in <a href="%s" title="Go to source"><strong>%s</string>%s</a></span>', $this->escapeHtml($link), $file, 0 < $line ? ' line '.$line : ''); | |
365 } | 381 } |
366 | 382 |
367 /** | 383 /** |
368 * Formats an array as a string. | 384 * Formats an array as a string. |
369 * | 385 * |