Yaffs site version 1.1
[yaffs-website] / vendor / drush / drush / commands / core / outputformat / message.inc
1 <?php
2
3 /**
4  * Output formatter 'message'
5  *
6  * @param $data
7  *   The parameters for the render data
8  * @param $metadata
9  *   'message-template' - Provides the template string to use with dt().
10  *
11  * Code:
12  *
13  *   return array('a' => 1, 'b' => 2);
14  *
15  * Given 'message-template' == 'The first is !a and the second is !b',
16  * output with --format=message:
17  *
18  *   The first is 1 and the second is 2
19  */
20 class drush_outputformat_message extends drush_outputformat {
21   function format($data, $metadata) {
22     $result = '';
23     if (isset($metadata['message-template'])) {
24       foreach ($data as $key => $value) {
25         $data_for_dt['!' . $key] = $value;
26       }
27       $result = dt($metadata['message-template'], $data_for_dt);
28     }
29     return $result;
30   }
31 }