9f8596eb22d149fe5e55f8c5e91cfdbdbf8291b3
[yaffs-website] / vendor / drush / drush / tests / resources / modules / d8 / woot / src / Commands / WootCommands.php
1 <?php
2 namespace Drupal\woot\Commands;
3
4 use Consolidation\OutputFormatters\StructuredData\RowsOfFields;
5
6 /**
7  * Commandfiles must be listed in a module's drush.services.yml file.
8  */
9 class WootCommands
10 {
11     /**
12      * Woot mightily.
13      *
14      * @command woot
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 concatenate two parameters. If the --flip flag
26      * is provided, then the result is the concatination of two and one.
27      *
28      * @command my-cat
29      * @param string $one The first parameter.
30      * @param string $two The other parameter.
31      * @option boolean $flip Whether or not the second parameter should come first in the result.
32      * @aliases c
33      * @usage bet alpha --flip
34      *   Concatinate "alpha" and "bet".
35      */
36     public function myCat($one, $two = '', $options = ['flip' => false])
37     {
38         if ($options['flip']) {
39             return "{$two}{$one}";
40         }
41         return "{$one}{$two}";
42     }
43
44     /**
45      * Demonstrate formatters.  Default format is 'table'.
46      *
47      * @command try:formatters
48      * @field-labels
49      *   first: I
50      *   second: II
51      *   third: III
52      * @usage try:formatters --format=yaml
53      *   Emit yaml.
54      * @usage try:formatters --format=csv
55      *   Emit CSV.
56      * @usage try:formatters --fields=first,third
57      *   Emit some fields.
58      * @usage try:formatters --fields=III,II
59      *   Emit other fields.
60      * @aliases try-formatters
61      * @return \Consolidation\OutputFormatters\StructuredData\RowsOfFields
62      */
63     public function tryFormatters($options = ['format' => 'table', 'fields' => ''])
64     {
65         $outputData = [
66             'en' => [ 'first' => 'One',  'second' => 'Two',  'third' => 'Three' ],
67             'de' => [ 'first' => 'Eins', 'second' => 'Zwei', 'third' => 'Drei'  ],
68             'jp' => [ 'first' => 'Ichi', 'second' => 'Ni',   'third' => 'San'   ],
69             'es' => [ 'first' => 'Uno',  'second' => 'Dos',  'third' => 'Tres'  ],
70         ];
71         return new RowsOfFields($outputData);
72     }
73
74     /**
75      * This command info is altered.
76      *
77      * @command woot:altered
78      * @aliases woot-initial-alias
79      */
80     public function wootAltered()
81     {
82     }
83 }