src/Log/Debug.php
public static function getContext($contexte, $rcontexte = NULL)
  {
    $dump = '';

    $segmentId = uniqid();
    $dump .= '<div class="dump_segment_content">';
    $dump .= '<div onclick="javascript:debugOpenClose(\'' . $segmentId . '\');" class="dump_segment_content_header" id="dump_segment_' . $segmentId . '">';
    $dump .= '<b>' . $contexte['file'] . '</b> ligne ' . $contexte['line'] . '</div>';
    $dump .= '<div class="dump_segment_content_main" style="display:none;" id="dump_segment_content_' . $segmentId . '">';

    if (!is_null($rcontexte) && isset($rcontexte['function']) && $rcontexte['function'] != '') {
      $dump .= '<div class="dump_segment_content_context">';
      if (isset($rcontexte['class'])) {
        $dump .= '<div class="dump_segment_content_context_line"><b>classe :</b> ' . $rcontexte['class'] . '</div>';
      }
      $dump .= '<div class="dump_segment_content_context_line"><b>méthode :</b> ' . $rcontexte['function'] . "(";

      if (isset($rcontexte['class'])) {
        // Cas d'une méthode
        $rm = new \ReflectionMethod($rcontexte['class'], $rcontexte['function']);
        $argsname = $rm->getParameters();
        $args = $rcontexte['args'];

        $nb = count($argsname);
        for ($i = 0; $i < $nb; $i++) {
          $ap = $argsname[$i];
          if ($i > 0) {
            $dump .= ', ';
          }
          $dump .= $argsname[$i]->name;
        }
      } else {
        // Cas d'une fonction
        $args = $rcontexte['args'];

        $nb = count($args);
        for ($i = 0; $i < $nb; $i++) {
          if ($i > 0) {
            $dump .= ', ';
          }
          $dump .= $i . '=\'' . $args[$i] . '\'';
        }
      }
      $dump .= ')</div>';
      $dump .= '</div>';
    }

    $file = new File($contexte['file']);
    $index = $contexte['line'] - 5;
    if ($index < 0) {
      $index = 0;
    }
    $fileLines = $file->getLines($index, 11, false);

    $nb = count($fileLines);
    for ($i = 0; $i < $nb; $i++) {
      if ($index == $contexte['line'] - 1) {
        $dump .= '<div class="dump_file_line dump_file_line_selected">';
      } else {
        $dump .= '<div class="dump_file_line">';
      }

      $dump .= '<div class="dump_file_line_number">' . ($index + 1) . '</div><div class="dump_file_line_content">' . htmlspecialchars($fileLines[$i]) . '</div>';
      $index++;
      $dump .= '</div>';
    }
    $dump .= '<div class="clear"></div>';
    $dump .= '</div>';
    $dump .= '</div>';

    return $dump;
  }
public static function getContext($contexte, $rcontexte = NULL)
  {
    $dump = '';

    $segmentId = uniqid();
    $dump .= '<div class="dump_segment_content">';
    $dump .= '<div onclick="javascript:debugOpenClose(\'' . $segmentId . '\');" class="dump_segment_content_header" id="dump_segment_' . $segmentId . '">';
    $dump .= '<b>' . $contexte['file'] . '</b> ligne ' . $contexte['line'] . '</div>';
    $dump .= '<div class="dump_segment_content_main" style="display:none;" id="dump_segment_content_' . $segmentId . '">';

    if (!is_null($rcontexte) && isset($rcontexte['function']) && $rcontexte['function'] != '') {
      $dump .= '<div class="dump_segment_content_context">';
      if (isset($rcontexte['class'])) {
        $dump .= '<div class="dump_segment_content_context_line"><b>classe :</b> ' . $rcontexte['class'] . '</div>';
      }
      $dump .= '<div class="dump_segment_content_context_line"><b>méthode :</b> ' . $rcontexte['function'] . "(";

      if (isset($rcontexte['class'])) {
        // Cas d'une méthode
        $rm = new \ReflectionMethod($rcontexte['class'], $rcontexte['function']);
        $argsname = $rm->getParameters();
        $args = $rcontexte['args'];

        $nb = count($argsname);
        for ($i = 0; $i < $nb; $i++) {
          $ap = $argsname[$i];
          if ($i > 0) {
            $dump .= ', ';
          }
          $dump .= $argsname[$i]->name;
        }
      } else {
        // Cas d'une fonction
        $args = $rcontexte['args'];

        $nb = count($args);
        for ($i = 0; $i < $nb; $i++) {
          if ($i > 0) {
            $dump .= ', ';
          }
          $dump .= $i . '=\'' . $args[$i] . '\'';
        }
      }
      $dump .= ')</div>';
      $dump .= '</div>';
    }

    $file = new File($contexte['file']);
    $index = $contexte['line'] - 5;
    if ($index < 0) {
      $index = 0;
    }
    $fileLines = $file->getLines($index, 11, false);

    $nb = count($fileLines);
    for ($i = 0; $i < $nb; $i++) {
      if ($index == $contexte['line'] - 1) {
        $dump .= '<div class="dump_file_line dump_file_line_selected">';
      } else {
        $dump .= '<div class="dump_file_line">';
      }

      $dump .= '<div class="dump_file_line_number">' . ($index + 1) . '</div><div class="dump_file_line_content">' . htmlspecialchars($fileLines[$i]) . '</div>';
      $index++;
      $dump .= '</div>';
    }
    $dump .= '<div class="clear"></div>';
    $dump .= '</div>';
    $dump .= '</div>';

    return $dump;
  }
Retourne la trace d'un contexte

@param  array    $contexte   Contexte à analyser
@param  array    $rcontexte  Contexte servant à analyser la méthode courante (contexte à n+1)
@return string               Contexte formaté