[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/libraries/src/HTML/Helpers/ -> Debug.php (source)

   1  <?php
   2  
   3  /**
   4   * Joomla! Content Management System
   5   *
   6   * @copyright  (C) 2017 Open Source Matters, Inc. <https://www.joomla.org>
   7   * @license    GNU General Public License version 2 or later; see LICENSE.txt
   8   */
   9  
  10  namespace Joomla\CMS\HTML\Helpers;
  11  
  12  use Joomla\CMS\Filesystem\Path;
  13  use Joomla\CMS\HTML\HTMLHelper;
  14  
  15  // phpcs:disable PSR1.Files.SideEffects
  16  \defined('JPATH_PLATFORM') or die;
  17  // phpcs:enable PSR1.Files.SideEffects
  18  
  19  /**
  20   * Extended Utility class for render debug information.
  21   *
  22   * @since  3.7.0
  23   */
  24  abstract class Debug
  25  {
  26      /**
  27       * xdebug.file_link_format from the php.ini.
  28       *
  29       * Make this property public to support test.
  30       *
  31       * @var    string
  32       *
  33       * @since  3.7.0
  34       */
  35      public static $xdebugLinkFormat;
  36  
  37      /**
  38       * Replaces the Joomla! root with "JROOT" to improve readability.
  39       * Formats a link with a special value xdebug.file_link_format
  40       * from the php.ini file.
  41       *
  42       * @param   string  $file  The full path to the file.
  43       * @param   string  $line  The line number.
  44       *
  45       * @return  string
  46       *
  47       * @throws  \InvalidArgumentException
  48       *
  49       * @since   3.7.0
  50       */
  51      public static function xdebuglink($file, $line = '')
  52      {
  53          if (static::$xdebugLinkFormat === null) {
  54              static::$xdebugLinkFormat = ini_get('xdebug.file_link_format');
  55          }
  56  
  57          $link = str_replace(JPATH_ROOT, 'JROOT', Path::clean($file));
  58          $link .= $line ? ':' . $line : '';
  59  
  60          if (static::$xdebugLinkFormat) {
  61              $href = static::$xdebugLinkFormat;
  62              $href = str_replace('%f', $file, $href);
  63              $href = str_replace('%l', $line, $href);
  64  
  65              $html = HTMLHelper::_('link', $href, $link);
  66          } else {
  67              $html = $link;
  68          }
  69  
  70          return $html;
  71      }
  72  }


Generated: Wed Sep 7 05:41:13 2022 Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer