| 1 |  |  | <?php | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2 |  |  | namespace RoboExample\Robo\Plugin\Commands; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 3 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 4 |  |  | use Robo\Result; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 5 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 6 |  |  | use Consolidation\AnnotatedCommand\CommandData; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 7 |  |  | use Consolidation\OutputFormatters\Options\FormatterOptions; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 8 |  |  | use Consolidation\OutputFormatters\StructuredData\RowsOfFields; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 9 |  |  | use Consolidation\OutputFormatters\StructuredData\PropertyList; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 10 |  |  | use Symfony\Component\Console\Input\InputOption; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 11 |  |  | use Symfony\Component\Console\Input\InputInterface; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 12 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 13 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 14 |  |  |  * Example Robo Plugin Commands. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 15 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 16 |  |  |  * To create a Robo Plugin, create a standard Composer project. The | 
            
                                                                                                            
                            
            
                                    
            
            
                | 17 |  |  |  * namespace for your commands must end Robo\Plugin\Commands, and | 
            
                                                                                                            
                            
            
                                    
            
            
                | 18 |  |  |  * this suffix must immediately follow some namespace in your composer.json | 
            
                                                                                                            
                            
            
                                    
            
            
                | 19 |  |  |  * file's autoload section. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 20 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 21 |  |  |  * For example: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 22 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 23 |  |  |  * "autoload": { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 24 |  |  |  *         "psr-4": { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 25 |  |  |  *             "RoboExample\\": "src" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 26 |  |  |  *         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 27 |  |  |  *     }, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 28 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 29 |  |  |  * In this instance, the namespace for your plugin commands must be | 
            
                                                                                                            
                            
            
                                    
            
            
                | 30 |  |  |  * RoboExample\Robo\Plugin\Commands. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 31 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 32 |  |  | class ExampleCommands extends \Robo\Tasks | 
            
                                                                                                            
                            
            
                                    
            
            
                | 33 |  |  | { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 34 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 35 |  |  |      * Watch a file. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 36 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 37 |  |  |      * Demonstrates the 'watch' command. Runs 'composer update' any time | 
            
                                                                                                            
                            
            
                                    
            
            
                | 38 |  |  |      * composer.json changes. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 39 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 40 |  |  |     public function tryWatch() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 41 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 42 |  |  |         $this->taskWatch()->monitor(['composer.json', 'composer.lock'], function () { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 43 |  |  |             $this->taskComposerUpdate()->run(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 44 |  |  |         })->run(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 45 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 46 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 47 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 48 |  |  |      * Demonstrates Robo input APIs. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 49 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 50 |  |  |     public function tryInput() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 51 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 52 |  |  |         $this->say('The <b>expression</b> <bogus>is</bogus> <info>a < b</> it even works'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 53 |  |  |         $answer = $this->ask('how are you?'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 54 |  |  |         $this->say('You are '.$answer); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 55 |  |  |         $yes = $this->confirm('Do you want one more question?'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 56 |  |  |         if (!$yes) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 57 |  |  |             return Result::cancelled(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 58 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 59 |  |  |         $lang = $this->askDefault('what is your favorite scripting language?', 'PHP'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 60 |  |  |         $this->say($lang); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 61 |  |  |         $pin = $this->askHidden('Ok, now tell your PIN code (it is hidden)'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 62 |  |  |         $this->yell('Ha-ha, your pin code is: '.$pin); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 63 |  |  |         $this->say('Bye!'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 64 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 65 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 66 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 67 |  |  |      * Demonstrate Robo configuration. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 68 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 69 |  |  |      * Config values are loaded from the followig locations: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 70 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 71 |  |  |      *  - [Robo Project]/robo.yml | 
            
                                                                                                            
                            
            
                                    
            
            
                | 72 |  |  |      *  - $HOME/.robo/robo.yml | 
            
                                                                                                            
                            
            
                                    
            
            
                | 73 |  |  |      *  - $CWD/robo.yml | 
            
                                                                                                            
                            
            
                                    
            
            
                | 74 |  |  |      *  - Environment variables ROBO_CONFIG_KEY (e.g. ROBO_OPTIONS_PROGRESS_DELAY) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 75 |  |  |      *  - Overridden on the commandline via -Doptions.progress-delay=value | 
            
                                                                                                            
                            
            
                                    
            
            
                | 76 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 77 |  |  |      * @param string $key Name of the option to read (e.g. options.progress-delay) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 78 |  |  |      * @option opt An option whose value is printed. Can be overridden in | 
            
                                                                                                            
                            
            
                                    
            
            
                | 79 |  |  |      *   configuration via the configuration key command.try.config.options.opt. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 80 |  |  |      * @option show-all Also print out the value of all configuration options | 
            
                                                                                                            
                            
            
                                    
            
            
                | 81 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 82 |  |  |     public function tryConfig($key = 'options.progress-delay', $options = ['opt' => '0', 'show-all' => false]) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 83 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 84 |  |  |         $value = \Robo\Robo::config()->get($key); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 85 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 86 |  |  |         $this->say("The value of $key is " . var_export($value, true)); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 87 |  |  |         $this->say("The value of --opt (command.try.config.options.opt) is " . var_export($options['opt'], true)); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 88 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 89 |  |  |         if ($options['show-all']) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 90 |  |  |             $this->say(var_export(\Robo\Robo::config()->export(), true) . "\n"); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 91 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 92 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 93 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 94 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 95 |  |  |      * Demonstrates serial execution. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 96 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 97 |  |  |      * @option $printed Print the output of each process. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 98 |  |  |      * @option $error Include an extra process that fails. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 99 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 100 |  |  |     public function tryExec($options = ['printed' => true, 'error' => false]) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 101 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 102 |  |  |         $dir = dirname(dirname(dirname(dirname(dirname(__DIR__))))); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 103 |  |  |         $tasks = $this | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 104 |  |  |             ->taskExec('php') | 
            
                                                                                                            
                            
            
                                    
            
            
                | 105 |  |  |                 ->args(["$dir/tests/_data/parascript.php", "hey", "4"]) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 106 |  |  |             ->taskExec('php') | 
            
                                                                                                            
                            
            
                                    
            
            
                | 107 |  |  |                 ->args(["$dir/tests/_data/parascript.php", "hoy", "3"]) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 108 |  |  |             ->taskExec('php') | 
            
                                                                                                            
                            
            
                                    
            
            
                | 109 |  |  |                 ->args(["$dir/tests/_data/parascript.php", "gou", "2"]) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 110 |  |  |             ->taskExec('php') | 
            
                                                                                                            
                            
            
                                    
            
            
                | 111 |  |  |                 ->args(["$dir/tests/_data/parascript.php", "die", "1"]); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 112 |  |  |         if ($options['error']) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 113 |  |  |             $tasks->taskExec('ls')->arg("$dir/tests/_data/filenotfound"); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 114 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 115 |  |  |         return $tasks->run(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 116 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 117 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 118 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 119 |  |  |      * Demonstrates parallel execution. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 120 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 121 |  |  |      * @option $printed Print the output of each process. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 122 |  |  |      * @option $error Include an extra process that fails. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 123 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 124 |  |  |     public function tryPara($options = ['printed' => true, 'error' => false]) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 125 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 126 |  |  |         $dir = dirname(dirname(dirname(dirname(dirname(__DIR__))))); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 127 |  |  |         $para = $this->taskParallelExec() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 128 |  |  |             ->printed($options['printed']) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 129 |  |  |             ->process("php $dir/tests/_data/parascript.php hey 4") | 
            
                                                                                                            
                            
            
                                    
            
            
                | 130 |  |  |             ->process("php $dir/tests/_data/parascript.php hoy 3") | 
            
                                                                                                            
                            
            
                                    
            
            
                | 131 |  |  |             ->process("php $dir/tests/_data/parascript.php gou 2") | 
            
                                                                                                            
                            
            
                                    
            
            
                | 132 |  |  |             ->process("php $dir/tests/_data/parascript.php die 1"); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 133 |  |  |         if ($options['error']) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 134 |  |  |             $para->process("ls $dir/tests/_data/filenotfound"); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 135 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 136 |  |  |         return $para->run(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 137 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 138 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 139 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 140 |  |  |      * try:opt-required | 
            
                                                                                                            
                            
            
                                    
            
            
                | 141 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 142 |  |  |     public function tryOptRequired($options = ['foo' => InputOption::VALUE_REQUIRED]) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 143 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 144 |  |  |         print "foo is " . $options['foo']; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 145 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 146 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 147 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 148 |  |  |      * Demonstrates Robo argument passing. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 149 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 150 |  |  |      * @param string $a The first parameter. Required. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 151 |  |  |      * @param string $b The second parameter. Optional. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 152 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 153 |  |  |     public function tryArgs($a, $b = 'default') | 
            
                                                                                                            
                            
            
                                    
            
            
                | 154 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 155 |  |  |         $this->say("The parameter a is $a and b is $b"); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 156 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 157 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 158 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 159 |  |  |      * Demonstrate Robo variable argument passing. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 160 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 161 |  |  |      * @param array $a A list of commandline parameters. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 162 |  |  |      * @param array $options | 
            
                                                                                                            
                            
            
                                    
            
            
                | 163 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 164 |  |  |     public function tryArrayArgs(array $a, array $options = ['foo' => []]) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 165 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 166 |  |  |         $this->say("The parameters passed are:\n" . var_export($a, true)); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 167 |  |  |         if (!empty($options['foo'])) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 168 |  |  |             $this->say("The options passed via --foo are:\n" . var_export($options['foo'], true)); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 169 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 170 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 171 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 172 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 173 |  |  |      * Demonstrate use of Symfony $input object in Robo in place of | 
            
                                                                                                            
                            
            
                                    
            
            
                | 174 |  |  |      * the usual "parameter arguments". | 
            
                                                                                                            
                            
            
                                    
            
            
                | 175 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 176 |  |  |      * @arg array $a A list of commandline parameters. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 177 |  |  |      * @option foo | 
            
                                                                                                            
                            
            
                                    
            
            
                | 178 |  |  |      * @default a [] | 
            
                                                                                                            
                            
            
                                    
            
            
                | 179 |  |  |      * @default foo [] | 
            
                                                                                                            
                            
            
                                    
            
            
                | 180 |  |  |      */ | 
            
                                                                                                            
                            
            
                                                                    
                                                                                                        
            
            
                | 181 |  | View Code Duplication |     public function trySymfony(InputInterface $input) | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 182 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 183 |  |  |         $a = $input->getArgument('a'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 184 |  |  |         $this->say("The parameters passed are:\n" . var_export($a, true)); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 185 |  |  |         $foo = $input->getOption('foo'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 186 |  |  |         if (!empty($foo)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 187 |  |  |             $this->say("The options passed via --foo are:\n" . var_export($foo, true)); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 188 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 189 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 190 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 191 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 192 |  |  |      * Demonstrate Robo boolean options. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 193 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 194 |  |  |      * @param $opts The options. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 195 |  |  |      * @option boolean $silent Supress output. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 196 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 197 |  |  |     public function tryOptbool($opts = ['silent|s' => false]) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 198 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 199 |  |  |         if (!$opts['silent']) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 200 |  |  |             $this->say("Hello, world"); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 201 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 202 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 203 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 204 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 205 |  |  |      * Demonstrate the use of the PHP built-in webserver. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 206 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 207 |  |  |     public function tryServer() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 208 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 209 |  |  |         return $this->taskServer(8000) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 210 |  |  |             ->dir('site') | 
            
                                                                                                            
                            
            
                                    
            
            
                | 211 |  |  |             ->arg('site/index.php') | 
            
                                                                                                            
                            
            
                                    
            
            
                | 212 |  |  |             ->run(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 213 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 214 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 215 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 216 |  |  |      * Demonstrate the use of the Robo open-browser task. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 217 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 218 |  |  |     public function tryOpenBrowser() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 219 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 220 |  |  |         return $this->taskOpenBrowser([ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 221 |  |  |             'http://robo.li', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 222 |  |  |             'https://github.com/consolidation-org/Robo' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 223 |  |  |             ])->run(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 224 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 225 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 226 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 227 |  |  |      * Demonstrate Robo error output and command failure. | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 228 |  |  |      */ | 
            
                                                                        
                            
            
                                    
            
            
                | 229 |  |  |     public function tryError() | 
            
                                                                        
                            
            
                                    
            
            
                | 230 |  |  |     { | 
            
                                                                        
                            
            
                                    
            
            
                | 231 |  |  |         return $this->taskExec('ls xyzzy' . date('U'))->dir('/tmp')->run(); | 
            
                                                                        
                            
            
                                    
            
            
                | 232 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 233 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 234 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 235 |  |  |      * Demonstrate Robo standard output and command success. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 236 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 237 |  |  |     public function trySuccess() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 238 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 239 |  |  |         return $this->_exec('pwd'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 240 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 241 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 242 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 243 |  |  |      * @field-labels | 
            
                                                                                                            
                            
            
                                    
            
            
                | 244 |  |  |      *   name: Name | 
            
                                                                                                            
                            
            
                                    
            
            
                | 245 |  |  |      *   species: Species | 
            
                                                                                                            
                            
            
                                    
            
            
                | 246 |  |  |      *   legs: Legs | 
            
                                                                                                            
                            
            
                                    
            
            
                | 247 |  |  |      *   food: Favorite Food | 
            
                                                                                                            
                            
            
                                    
            
            
                | 248 |  |  |      *   id: Id | 
            
                                                                                                            
                            
            
                                    
            
            
                | 249 |  |  |      * @return PropertyList | 
            
                                                                                                            
                            
            
                                    
            
            
                | 250 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 251 |  |  |     public function tryInfo() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 252 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 253 |  |  |         $outputData = [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 254 |  |  |             'name' => 'fluffy', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 255 |  |  |             'species' => 'cat', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 256 |  |  |             'legs' => 4, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 257 |  |  |             'food' => 'salmon', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 258 |  |  |             'id' => 389245032, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 259 |  |  |         ]; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 260 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 261 |  |  |         $data = new PropertyList($outputData); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 262 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 263 |  |  |         // Add a render function to transform cell data when the output | 
            
                                                                                                            
                            
            
                                    
            
            
                | 264 |  |  |         // format is a table, or similar.  This allows us to add color | 
            
                                                                                                            
                            
            
                                    
            
            
                | 265 |  |  |         // information to the output without modifying the data cells when | 
            
                                                                                                            
                            
            
                                    
            
            
                | 266 |  |  |         // using yaml or json output formats. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 267 |  |  |         $data->addRendererFunction( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 268 |  |  |             // n.b. There is a fourth parameter $rowData that may be added here. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 269 |  |  |             function ($key, $cellData, FormatterOptions $options) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 270 |  |  |                 if ($key == 'name') { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 271 |  |  |                     return "<info>$cellData</>"; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 272 |  |  |                 } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 273 |  |  |                 return $cellData; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 274 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 275 |  |  |         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 276 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 277 |  |  |         return $data; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 278 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 279 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 280 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 281 |  |  |      * Demonstrate Robo formatters.  Default format is 'table'. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 282 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 283 |  |  |      * @field-labels | 
            
                                                                                                            
                            
            
                                    
            
            
                | 284 |  |  |      *   first: I | 
            
                                                                                                            
                            
            
                                    
            
            
                | 285 |  |  |      *   second: II | 
            
                                                                                                            
                            
            
                                    
            
            
                | 286 |  |  |      *   third: III | 
            
                                                                                                            
                            
            
                                    
            
            
                | 287 |  |  |      * @default-string-field second | 
            
                                                                                                            
                            
            
                                    
            
            
                | 288 |  |  |      * @usage try:formatters --format=yaml | 
            
                                                                                                            
                            
            
                                    
            
            
                | 289 |  |  |      * @usage try:formatters --format=csv | 
            
                                                                                                            
                            
            
                                    
            
            
                | 290 |  |  |      * @usage try:formatters --fields=first,third | 
            
                                                                                                            
                            
            
                                    
            
            
                | 291 |  |  |      * @usage try:formatters --fields=III,II | 
            
                                                                                                            
                            
            
                                    
            
            
                | 292 |  |  |      * @aliases tf | 
            
                                                                                                            
                            
            
                                    
            
            
                | 293 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 294 |  |  |      * @return \Consolidation\OutputFormatters\StructuredData\RowsOfFields | 
            
                                                                                                            
                            
            
                                    
            
            
                | 295 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 296 |  |  |     public function tryFormatters($somthing = 'default', $options = ['format' => 'table', 'fields' => '']) | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 297 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 298 |  |  |         $outputData = [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 299 |  |  |             'en' => [ 'first' => 'One',  'second' => 'Two',  'third' => 'Three' ], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 300 |  |  |             'de' => [ 'first' => 'Eins', 'second' => 'Zwei', 'third' => 'Drei'  ], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 301 |  |  |             'jp' => [ 'first' => 'Ichi', 'second' => 'Ni',   'third' => 'San'   ], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 302 |  |  |             'es' => [ 'first' => 'Uno',  'second' => 'Dos',  'third' => 'Tres'  ], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 303 |  |  |         ]; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 304 |  |  |         return new RowsOfFields($outputData); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 305 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 306 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 307 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 308 |  |  |      * Try word wrapping | 
            
                                                                                                            
                            
            
                                    
            
            
                | 309 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 310 |  |  |      * @field-labels | 
            
                                                                                                            
                            
            
                                    
            
            
                | 311 |  |  |      *   first: First | 
            
                                                                                                            
                            
            
                                    
            
            
                | 312 |  |  |      *   second: Second | 
            
                                                                                                            
                            
            
                                    
            
            
                | 313 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 314 |  |  |      * @return \Consolidation\OutputFormatters\StructuredData\RowsOfFields | 
            
                                                                                                            
                            
            
                                    
            
            
                | 315 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 316 |  |  |     public function tryWrap() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 317 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 318 |  |  |         $data = [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 319 |  |  |             [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 320 |  |  |                 'first' => 'This is a really long cell that contains a lot of data. When it is rendered, it should be wrapped across multiple lines.', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 321 |  |  |                 'second' => 'This is the second column of the same table. It is also very long, and should be wrapped across multiple lines, just like the first column.', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 322 |  |  |             ] | 
            
                                                                                                            
                            
            
                                    
            
            
                | 323 |  |  |         ]; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 324 |  |  |         return new RowsOfFields($data); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 325 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 326 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 327 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 328 |  |  |      * Demonstrate an alter hook with an option | 
            
                                                                                                            
                            
            
                                    
            
            
                | 329 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 330 |  |  |      * @hook alter try:formatters | 
            
                                                                                                            
                            
            
                                    
            
            
                | 331 |  |  |      * @option $french Add a row with French numbers. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 332 |  |  |      * @usage try:formatters --french | 
            
                                                                                                            
                            
            
                                    
            
            
                | 333 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 334 |  |  |     public function alterFormatters($result, CommandData $commandData) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 335 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 336 |  |  |         if ($commandData->input()->getOption('french')) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 337 |  |  |             $result['fr'] = [ 'first' => 'Un',  'second' => 'Deux',  'third' => 'Trois'  ]; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 338 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 339 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 340 |  |  |         return $result; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 341 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 342 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 343 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 344 |  |  |      * Demonstrate what happens when a command or a task | 
            
                                                                                                            
                            
            
                                    
            
            
                | 345 |  |  |      * throws an exception.  Note that typically, Robo commands | 
            
                                                                                                            
                            
            
                                    
            
            
                | 346 |  |  |      * should return Result objects rather than throw exceptions. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 347 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 348 |  |  |     public function tryException($options = ['task' => false]) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 349 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 350 |  |  |         if (!$options['task']) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 351 |  |  |             throw new RuntimeException('Command failed with an exception.'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 352 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 353 |  |  |         return new ExceptionTask('Task failed with an exception.'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 354 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 355 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 356 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 357 |  |  |      * Demonstrate deprecated task behavior. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 358 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 359 |  |  |      * Demonstrate what happens when using a task that is created via | 
            
                                                                                                            
                            
            
                                    
            
            
                | 360 |  |  |      * direct instantiation, which omits initialization done by the | 
            
                                                                                                            
                            
            
                                    
            
            
                | 361 |  |  |      * container.  Emits a warning message. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 362 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 363 |  |  |     public function tryDeprecated() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 364 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 365 |  |  |         // Calling 'new' directly without manually setting | 
            
                                                                                                            
                            
            
                                    
            
            
                | 366 |  |  |         // up dependencies will result in a deprecation warning. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 367 |  |  |         // @see RoboFile::trySuccess() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 368 |  |  |         return (new \Robo\Task\Base\Exec('pwd'))->run(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 369 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 370 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 371 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 372 |  |  |      * Demonstrate the use of a collection builder to chain multiple tasks | 
            
                                                                                                            
                            
            
                                    
            
            
                | 373 |  |  |      * together into a collection, which is executed once constructed. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 374 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 375 |  |  |      * For demonstration purposes only; this could, of course, be done | 
            
                                                                                                            
                            
            
                                    
            
            
                | 376 |  |  |      * with a single FilesystemStack. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 377 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 378 |  |  |     public function tryBuilder() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 379 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 380 |  |  |         return $this->collectionBuilder() | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 381 |  |  |             ->taskFilesystemStack() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 382 |  |  |                 ->mkdir('a') | 
            
                                                                                                            
                            
            
                                    
            
            
                | 383 |  |  |                 ->touch('a/a.txt') | 
            
                                                                                                            
                            
            
                                    
            
            
                | 384 |  |  |             ->taskFilesystemStack() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 385 |  |  |                 ->mkdir('a/b') | 
            
                                                                                                            
                            
            
                                    
            
            
                | 386 |  |  |                 ->touch('a/b/b.txt') | 
            
                                                                                                            
                            
            
                                    
            
            
                | 387 |  |  |             ->taskFilesystemStack() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 388 |  |  |                 ->mkdir('a/b/c') | 
            
                                                                                                            
                            
            
                                    
            
            
                | 389 |  |  |                 ->touch('a/b/c/c.txt') | 
            
                                                                                                            
                            
            
                                    
            
            
                | 390 |  |  |             ->run(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 391 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 392 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 393 |  |  |     public function tryState() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 394 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 395 |  |  |         return $this->collectionBuilder() | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 396 |  |  |             ->taskExec('uname -n') | 
            
                                                                                                            
                            
            
                                    
            
            
                | 397 |  |  |                 ->printOutput(false) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 398 |  |  |                 ->storeState('system-name') | 
            
                                                                                                            
                            
            
                                    
            
            
                | 399 |  |  |             ->taskFilesystemStack() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 400 |  |  |                 ->deferTaskConfiguration('mkdir', 'system-name') | 
            
                                                                                                            
                            
            
                                    
            
            
                | 401 |  |  |             ->run(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 402 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 403 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 404 |  |  |     public function tryBuilderRollback() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 405 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 406 |  |  |         // This example will create two builders, and add | 
            
                                                                                                            
                            
            
                                    
            
            
                | 407 |  |  |         // the first one as a child of the second in order | 
            
                                                                                                            
                            
            
                                    
            
            
                | 408 |  |  |         // to demonstrate nested rollbacks. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 409 |  |  |         $collection = $this->collectionBuilder() | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 410 |  |  |             ->taskFilesystemStack() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 411 |  |  |                 ->mkdir('g') | 
            
                                                                                                            
                            
            
                                    
            
            
                | 412 |  |  |                 ->touch('g/g.txt') | 
            
                                                                                                            
                            
            
                                    
            
            
                | 413 |  |  |             ->rollback( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 414 |  |  |                 $this->taskDeleteDir('g') | 
            
                                                                                                            
                            
            
                                    
            
            
                | 415 |  |  |             ) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 416 |  |  |             ->taskFilesystemStack() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 417 |  |  |                 ->mkdir('g/h') | 
            
                                                                                                            
                            
            
                                    
            
            
                | 418 |  |  |                 ->touch('g/h/h.txt') | 
            
                                                                                                            
                            
            
                                    
            
            
                | 419 |  |  |             ->taskFilesystemStack() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 420 |  |  |                 ->mkdir('g/h/i/c') | 
            
                                                                                                            
                            
            
                                    
            
            
                | 421 |  |  |                 ->touch('g/h/i/i.txt'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 422 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 423 |  |  |         return $this->collectionBuilder() | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 424 |  |  |             ->progressMessage('Start recursive collection') | 
            
                                                                                                            
                            
            
                                    
            
            
                | 425 |  |  |             ->addTask($collection) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 426 |  |  |             ->progressMessage('Done with recursive collection') | 
            
                                                                                                            
                            
            
                                    
            
            
                | 427 |  |  |             ->taskExec('ls xyzzy' . date('U')) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 428 |  |  |                 ->dir('/tmp') | 
            
                                                                                                            
                            
            
                                    
            
            
                | 429 |  |  |             ->run(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 430 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 431 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 432 |  |  |     public function tryWorkdir() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 433 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 434 |  |  |         // This example works like tryBuilderRollback, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 435 |  |  |         // but does equivalent operations using a working | 
            
                                                                                                            
                            
            
                                    
            
            
                | 436 |  |  |         // directory. The working directory is deleted on rollback | 
            
                                                                                                            
                            
            
                                    
            
            
                | 437 |  |  |         $collection = $this->collectionBuilder(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 438 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 439 |  |  |         $workdir = $collection->workDir('w'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 440 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 441 |  |  |         $collection | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 442 |  |  |             ->taskFilesystemStack() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 443 |  |  |                 ->touch("$workdir/g.txt") | 
            
                                                                                                            
                            
            
                                    
            
            
                | 444 |  |  |             ->taskFilesystemStack() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 445 |  |  |                 ->mkdir("$workdir/h") | 
            
                                                                                                            
                            
            
                                    
            
            
                | 446 |  |  |                 ->touch("$workdir/h/h.txt") | 
            
                                                                                                            
                            
            
                                    
            
            
                | 447 |  |  |             ->taskFilesystemStack() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 448 |  |  |                 ->mkdir("$workdir/h/i/c") | 
            
                                                                                                            
                            
            
                                    
            
            
                | 449 |  |  |                 ->touch("$workdir/h/i/i.txt"); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 450 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 451 |  |  |         return $this->collectionBuilder() | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 452 |  |  |             ->progressMessage('Start recursive collection') | 
            
                                                                                                            
                            
            
                                    
            
            
                | 453 |  |  |             ->addTask($collection) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 454 |  |  |             ->progressMessage('Done with recursive collection') | 
            
                                                                                                            
                            
            
                                    
            
            
                | 455 |  |  |             ->taskExec('ls xyzzy' . date('U')) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 456 |  |  |                 ->dir('/tmp') | 
            
                                                                                                            
                            
            
                                    
            
            
                | 457 |  |  |             ->run(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 458 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 459 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 460 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 461 |  |  |      * Demonstrates Robo temporary directory usage. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 462 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 463 |  |  |     public function tryTmpDir() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 464 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 465 |  |  |         // Set up a collection to add tasks to | 
            
                                                                                                            
                            
            
                                    
            
            
                | 466 |  |  |         $collection = $this->collectionBuilder(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 467 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 468 |  |  |         // Get a temporary directory to work in. Note that we get a path | 
            
                                                                                                            
                            
            
                                    
            
            
                | 469 |  |  |         // back, but the directory is not created until the task runs. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 470 |  |  |         $tmpPath = $collection->tmpDir(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 471 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 472 |  |  |         $result = $collection | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 473 |  |  |             ->taskWriteToFile("$tmpPath/file.txt") | 
            
                                                                                                            
                            
            
                                    
            
            
                | 474 |  |  |                 ->line('Example file') | 
            
                                                                                                            
                            
            
                                    
            
            
                | 475 |  |  |             ->run(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 476 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 477 |  |  |         if (is_dir($tmpPath)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 478 |  |  |             $this->say("The temporary directory at $tmpPath was not cleaned up after the collection completed."); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 479 |  |  |         } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 480 |  |  |             $this->say("The temporary directory at $tmpPath was automatically deleted."); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 481 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 482 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 483 |  |  |         return $result; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 484 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 485 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 486 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 487 |  |  |      * Description | 
            
                                                                                                            
                            
            
                                    
            
            
                | 488 |  |  |      * @param $options | 
            
                                                                                                            
                            
            
                                    
            
            
                | 489 |  |  |      * @option delay Miliseconds delay | 
            
                                                                                                            
                            
            
                                    
            
            
                | 490 |  |  |      * @return type | 
            
                                                                                                            
                            
            
                                    
            
            
                | 491 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 492 |  |  |     public function tryProgress($options = ['delay' => 500]) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 493 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 494 |  |  |         $delay = $options['delay']; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 495 |  |  |         $delayUntilProgressStart = \Robo\Robo::config()->get(\Robo\Config::PROGRESS_BAR_AUTO_DISPLAY_INTERVAL); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 496 |  |  |         $this->say("Progress bar will display after $delayUntilProgressStart seconds of activity."); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 497 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 498 |  |  |         $processList = range(1, 10); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 499 |  |  |         return $this->collectionBuilder() | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 500 |  |  |             ->taskForEach($processList) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 501 |  |  |                 ->iterationMessage('Processing {value}') | 
            
                                                                                                            
                            
            
                                    
            
            
                | 502 |  |  |                 ->call( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 503 |  |  |                     function ($value) use($delay) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 504 |  |  |                         // TaskForEach::call should only be used to do | 
            
                                                                                                            
                            
            
                                    
            
            
                | 505 |  |  |                         // non-Robo operations. To use Robo tasks in an | 
            
                                                                                                            
                            
            
                                    
            
            
                | 506 |  |  |                         // iterator, @see TaskForEach::withBuilder. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 507 |  |  |                         usleep($delay * 1000); // delay units: msec, usleep units: usec | 
            
                                                                                                            
                            
            
                                    
            
            
                | 508 |  |  |                     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 509 |  |  |                 ) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 510 |  |  |             ->run(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 511 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 512 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 513 |  |  |     public function tryIter() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 514 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 515 |  |  |         $workdir = 'build/iter-example'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 516 |  |  |         $this->say("Creating sample direcories in $workdir."); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 517 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 518 |  |  |         $processList = ['cats', 'dogs', 'sheep', 'fish', 'horses', 'cows']; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 519 |  |  |         return $this->collectionBuilder() | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 520 |  |  |             ->taskFilesystemStack() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 521 |  |  |                 ->mkdir($workdir) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 522 |  |  |             ->taskCleanDir($workdir) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 523 |  |  |             ->taskForEach($processList) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 524 |  |  |                 ->withBuilder( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 525 |  |  |                     function ($builder, $key, $value) use ($workdir) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 526 |  |  |                         return $builder | 
            
                                                                                                            
                            
            
                                    
            
            
                | 527 |  |  |                             ->taskFilesystemStack() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 528 |  |  |                                 ->mkdir("$workdir/$value"); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 529 |  |  |                     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 530 |  |  |                 ) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 531 |  |  |             ->run(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 532 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 533 |  |  | } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 534 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 535 |  |  | class ExceptionTask extends \Robo\Task\BaseTask | 
            
                                                                                                            
                            
            
                                    
            
            
                | 536 |  |  | { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 537 |  |  |     protected $message; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 538 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 539 |  |  |     public function __construct($message) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 540 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 541 |  |  |         $this->message = $message; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 542 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 543 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 544 |  |  |     public function run() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 545 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 546 |  |  |         throw new RuntimeException($this->message); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 547 |  |  |     } | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 548 |  |  | } | 
            
                                                        
            
                                    
            
            
                | 549 |  |  |  | 
            
                        
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.