yaml.inc

  1. 8.0.x commands/core/outputformat/yaml.inc
  2. 6.x commands/core/outputformat/yaml.inc
  3. 7.x commands/core/outputformat/yaml.inc
  4. master commands/core/outputformat/yaml.inc

Classes

Namesort descending Description
drush_outputformat_yaml Output formatter 'yaml'

File

commands/core/outputformat/yaml.inc
View source
  1. <?php
  2. use Symfony\Component\Yaml\Dumper;
  3. /**
  4. * Output formatter 'yaml'
  5. *
  6. * @param $data
  7. * The $data parameter is rendered in yaml
  8. * @param $metadata
  9. *
  10. * Code:
  11. *
  12. */
  13. class drush_outputformat_yaml extends drush_outputformat {
  14. function format($input, $metadata) {
  15. $dumper = new Dumper();
  16. // Set Yaml\Dumper's default indentation for nested nodes/collections to
  17. // 2 spaces for consistency with Drupal coding standards.
  18. $dumper->setIndentation(2);
  19. // The level where you switch to inline YAML is set to PHP_INT_MAX to
  20. // ensure this does not occur.
  21. $output = $dumper->dump($input, PHP_INT_MAX, NULL, NULL, TRUE);
  22. return $output;
  23. }
  24. }