YiiDebugViewHelper.php 771 B

12345678910111213141516171819202122232425262728293031323334
  1. <?php
  2. /**
  3. * YiiDebugViewHelper class file.
  4. */
  5. /**
  6. * YiiDebugViewHelper class.
  7. *
  8. * Contains static methods that can be used in views.
  9. *
  10. * @package YiiDebugToolbar
  11. * @since 1.1.7
  12. */
  13. class YiiDebugViewHelper
  14. {
  15. /**
  16. * Splits a text by putting each line in a div.
  17. *
  18. * The second and following lines are in a block of class "details".
  19. */
  20. public static function splitLinesInBlocks($txt)
  21. {
  22. $lines = explode("\n", $txt);
  23. $first = array_shift($lines);
  24. $details = "";
  25. if (count($lines) > 0) {
  26. $details = '<div class="hidden details"><div>'
  27. . join("</div><div>", $lines)
  28. . "</div></div>\n";
  29. }
  30. return '<div>' . $first ."</div>\n" . $details;
  31. }
  32. }