src/Log/Debug.php
protected static function dumpElement($var, $name = '', $maxSize = null)
  {
    $dump = '';

    // On récupère le type de variable
    $type = gettype($var);

    // Is parcourable
    $iterable = $type == 'object' || $type == 'array';

    // Affichage des informations sur l'élément courant
    $dump .= '<li>';
    $dump .= '<div class="dump_item">';

    if ($name !== "") {
      $dump .= '<div class="dump_name">' . $name . '</div><div class="dump_pleinseparator">&nbsp;</div>';
    }
    $dump .= '<div class="dump_type">' . $type . '</div>';
    if ($type == 'string') {
      $dump .= '<div class="dump_separator">&nbsp;</div><div class="dump_size">(' . strlen($var) . ' caractères)</div>';
    } else if ($type == 'object') {
      $dump .= '<div class="dump_separator">&nbsp;</div><div class="dump_size">' . get_class($var) . '</div>';
    } else if ($type == 'array') {
      $dump .= '<div class="dump_separator">&nbsp;</div><div class="dump_size">(' . count($var) . ' éléments)</div>';
    }
    $dump .= '<div class="dump_clear"></div>';
    $dump .= '</div>';

    // Affichage du contenu
    if ($type == 'string') {
      
      $dt = htmlspecialchars($var);
      if($maxSize && strlen($dt) > $maxSize){
        $dt = substr($dt, 0, $maxSize).'[...]';
      }
      $dump .= '<div class="dump_item_content"><pre>' . $dt . '</pre></div>';
    } else if ($type == 'boolean') {
      $dump .= '<div class="dump_item_content"><pre>' . ($var ? 'TRUE' : 'FALSE') . '</pre></div>';
    } else if ($type == 'object') {
      $dump .= '';
    } else if ($type == 'array') {
      $dump .= '<div class="dump_item_content"></div>';
    } else {
      $dump .= '<div class="dump_item_content"><pre>' . $var . '</pre></div>';
    }

    // On parcourt les éléments iterables
    if ($iterable) {
      $dump .= '<ul>';
      foreach ($var as $key => $e) {
        $dump .= static::dumpElement($e, $key, $maxSize);
      }
      $dump .= '</ul>';
    }

    // Fermeture balise élément
    $dump .= '</li>';
    return $dump;
  }
protected static function dumpElement($var, $name = '', $maxSize = null)
  {
    $dump = '';

    // On récupère le type de variable
    $type = gettype($var);

    // Is parcourable
    $iterable = $type == 'object' || $type == 'array';

    // Affichage des informations sur l'élément courant
    $dump .= '<li>';
    $dump .= '<div class="dump_item">';

    if ($name !== "") {
      $dump .= '<div class="dump_name">' . $name . '</div><div class="dump_pleinseparator">&nbsp;</div>';
    }
    $dump .= '<div class="dump_type">' . $type . '</div>';
    if ($type == 'string') {
      $dump .= '<div class="dump_separator">&nbsp;</div><div class="dump_size">(' . strlen($var) . ' caractères)</div>';
    } else if ($type == 'object') {
      $dump .= '<div class="dump_separator">&nbsp;</div><div class="dump_size">' . get_class($var) . '</div>';
    } else if ($type == 'array') {
      $dump .= '<div class="dump_separator">&nbsp;</div><div class="dump_size">(' . count($var) . ' éléments)</div>';
    }
    $dump .= '<div class="dump_clear"></div>';
    $dump .= '</div>';

    // Affichage du contenu
    if ($type == 'string') {
      
      $dt = htmlspecialchars($var);
      if($maxSize && strlen($dt) > $maxSize){
        $dt = substr($dt, 0, $maxSize).'[...]';
      }
      $dump .= '<div class="dump_item_content"><pre>' . $dt . '</pre></div>';
    } else if ($type == 'boolean') {
      $dump .= '<div class="dump_item_content"><pre>' . ($var ? 'TRUE' : 'FALSE') . '</pre></div>';
    } else if ($type == 'object') {
      $dump .= '';
    } else if ($type == 'array') {
      $dump .= '<div class="dump_item_content"></div>';
    } else {
      $dump .= '<div class="dump_item_content"><pre>' . $var . '</pre></div>';
    }

    // On parcourt les éléments iterables
    if ($iterable) {
      $dump .= '<ul>';
      foreach ($var as $key => $e) {
        $dump .= static::dumpElement($e, $key, $maxSize);
      }
      $dump .= '</ul>';
    }

    // Fermeture balise élément
    $dump .= '</li>';
    return $dump;
  }
Dump d'un élément (fonction recursive)

@param  mixed   $var   Variable à tracer
@param  string  $name  Nom de l'élément ('' par défaut)
@param  integer  $maxSize  Si renseigné, permet de limiter la taille des variables tracées.
@return string         Dump de la variable