DevelDumperManagerInterface.php 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. <?php
  2. namespace Drupal\devel;
  3. /**
  4. * Interface DevelDumperManagerInterface
  5. */
  6. interface DevelDumperManagerInterface {
  7. /**
  8. * Dumps information about a variable.
  9. *
  10. * @param mixed $input
  11. * The variable to dump.
  12. * @param string $name
  13. * (optional) The label to output before variable, defaults to NULL.
  14. * @param string $plugin_id
  15. * (optional) The plugin ID, defaults to NULL.
  16. */
  17. public function dump($input, $name = NULL, $plugin_id = NULL);
  18. /**
  19. * Returns a string representation of a variable.
  20. *
  21. * @param mixed $input
  22. * The variable to dump.
  23. * @param string $name
  24. * (optional) The label to output before variable, defaults to NULL.
  25. * @param string $plugin_id
  26. * (optional) The plugin ID, defaults to NULL.
  27. *
  28. * @return string
  29. * String representation of a variable.
  30. */
  31. public function export($input, $name = NULL, $plugin_id = NULL);
  32. /**
  33. * Sets a message with a string representation of a variable.
  34. *
  35. * @param mixed $input
  36. * The variable to dump.
  37. * @param string $name
  38. * (optional) The label to output before variable, defaults to NULL.
  39. * @param string $type
  40. * (optional) The message's type. Defaults to 'status'.
  41. * @param string $plugin_id
  42. * (optional) The plugin ID, defaults to NULL.
  43. */
  44. public function message($input, $name = NULL, $type = 'status', $plugin_id = NULL);
  45. /**
  46. * Logs a variable to a drupal_debug.txt in the site's temp directory.
  47. *
  48. * @param mixed $input
  49. * The variable to log to the drupal_debug.txt log file.
  50. * @param string $name
  51. * (optional) If set, a label to output before $data in the log file.
  52. * @param string $plugin_id
  53. * (optional) The plugin ID, defaults to NULL.
  54. *
  55. * @return void|false
  56. * Empty if successful, FALSE if the log file could not be written.
  57. *
  58. * @see dd()
  59. * @see http://drupal.org/node/314112
  60. */
  61. public function debug($input, $name = NULL, $plugin_id = NULL);
  62. /**
  63. * Wrapper for ::dump() and ::export().
  64. *
  65. * @param mixed $input
  66. * The variable to dump.
  67. * @param string $name
  68. * (optional) The label to output before variable, defaults to NULL.
  69. * @param bool $export
  70. * (optional) Whether return string representation of a variable.
  71. * @param string $plugin_id
  72. * (optional) The plugin ID, defaults to NULL.
  73. *
  74. * @return string|null
  75. * String representation of a variable if $export is set to TRUE,
  76. * NULL otherwise.
  77. */
  78. public function dumpOrExport($input, $name = NULL, $export = TRUE, $plugin_id = NULL);
  79. /**
  80. * Returns a render array representation of a variable.
  81. *
  82. * @param mixed $input
  83. * The variable to export.
  84. * @param string $name
  85. * (optional) The label to output before variable, defaults to NULL.
  86. * @param string $plugin_id
  87. * (optional) The plugin ID, defaults to NULL.
  88. *
  89. * @return array
  90. * String representation of a variable wrapped in a render array.
  91. */
  92. public function exportAsRenderable($input, $name = NULL, $plugin_id = NULL);
  93. }