ba230750680a4dd7a87c71103ad25092c7677cb9
[yaffs-website] / vendor / drush / drush / tests / resources / modules / d7 / woot / Commands / WootCommands.php
1 <?php
2 namespace Drupal\woot\Commands;
3
4 use Consolidation\OutputFormatters\StructuredData\RowsOfFields;
5
6 /**
7  * For commands that are parts of modules, Drush expects to find commandfiles in
8  * __MODULE__/src/Command, and the namespace is Drupal/__MODULE__/Command.
9  */
10 class WootCommands
11 {
12     /**
13      * Woot mightily.
14      *
15      * @aliases wt
16      */
17     public function woot()
18     {
19       return 'Woot!';
20     }
21
22     /**
23      * This is the my-cat command
24      *
25      * This command will concatinate two parameters. If the --flip flag
26      * is provided, then the result is the concatination of two and one.
27      *
28      * @param string $one The first parameter.
29      * @param string $two The other parameter.
30      * @option boolean $flip Whether or not the second parameter should come first in the result.
31      * @aliases c
32      * @usage bet alpha --flip
33      *   Concatinate "alpha" and "bet".
34      */
35     public function myCat($one, $two = '', $options = ['flip' => false])
36     {
37         if ($options['flip']) {
38             return "{$two}{$one}";
39         }
40         return "{$one}{$two}";
41     }
42
43     /**
44      * Demonstrate formatters.  Default format is 'table'.
45      *
46      * @field-labels
47      *   first: I
48      *   second: II
49      *   third: III
50      * @usage try:formatters --format=yaml
51      * @usage try:formatters --format=csv
52      * @usage try:formatters --fields=first,third
53      * @usage try:formatters --fields=III,II
54      * @return \Consolidation\OutputFormatters\StructuredData\RowsOfFields
55      */
56     public function tryFormatters($options = ['format' => 'table', 'fields' => ''])
57     {
58         $outputData = [
59             'en' => [ 'first' => 'One',  'second' => 'Two',  'third' => 'Three' ],
60             'de' => [ 'first' => 'Eins', 'second' => 'Zwei', 'third' => 'Drei'  ],
61             'jp' => [ 'first' => 'Ichi', 'second' => 'Ni',   'third' => 'San'   ],
62             'es' => [ 'first' => 'Uno',  'second' => 'Dos',  'third' => 'Tres'  ],
63         ];
64         return new RowsOfFields($outputData);
65     }
66 }