5cfe70dd4ef153f12f02d32df59149bac957f080
[yaffs-website] / web / modules / contrib / devel / src / DevelDumperBase.php
1 <?php
2
3 namespace Drupal\devel;
4
5 use Drupal\Core\Plugin\PluginBase;
6 use Drupal\devel\Render\FilteredMarkup;
7
8 /**
9  * Defines a base devel dumper implementation.
10  *
11  * @see \Drupal\devel\Annotation\DevelDumper
12  * @see \Drupal\devel\DevelDumperInterface
13  * @see \Drupal\devel\DevelDumperPluginManager
14  * @see plugin_api
15  */
16 abstract class DevelDumperBase extends PluginBase implements DevelDumperInterface {
17
18   /**
19    * {@inheritdoc}
20    */
21   public function dump($input, $name = NULL) {
22     echo (string) $this->export($input, $name);
23   }
24
25   /**
26    * {@inheritdoc}
27    */
28   public function exportAsRenderable($input, $name = NULL) {
29     return ['#markup' => $this->export($input, $name)];
30   }
31
32   /**
33    * Wrapper for \Drupal\Core\Render\Markup::create().
34    *
35    * @param string $input
36    *   The input string to mark as safe.
37    *
38    * @return string
39    *   The unaltered input value.
40    */
41   protected function setSafeMarkup($input) {
42     return FilteredMarkup::create($input);
43   }
44
45 }