sweetchuck / robo-stringy
Exposes Stringy string manipulation methods
Installs: 97 011
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 3
Forks: 0
Open Issues: 0
Type:robo-tasks
Requires
- php: >=7.2
- consolidation/robo: ^2.0
- danielstjules/stringy: ^3.1
Requires (Dev)
- codeception/codeception: ^4.0
- codeception/module-asserts: ^1.1
- squizlabs/php_codesniffer: ^3.5
- sweetchuck/codeception-module-robo-task-runner: ^0.7
- sweetchuck/git-hooks: ^0.0
- sweetchuck/robo-git: ^0.2
- sweetchuck/robo-phpcs: ^0.1
- symfony/error-handler: ^5.0
- symfony/finder: ^4.0
- symfony/yaml: ^4.0
- webmozart/path-util: ^2.3
README
This Robo task is useful when you need to do string manipulation in a
\Robo\State\Data
.
Install
composer require sweetchuck/robo-stringy
Task - taskStringy()
<?php class RoboFile extends \Robo\Tasks { use \Sweetchuck\Robo\Stringy\StringyTaskLoader; /** * @command stringy:simple */ public function cmdStringySimple(string $text = 'Hello', string $suffix = 'World') { return $this ->collectionBuilder() ->addTask( $this ->taskStringy() ->setString($text) ->callIsUpperCase() ->callAppend(" $suffix") ->callUnderscored() ) ->addCode(function (\Robo\State\Data $data): int { $output = $this->output(); $output->writeln('Is upper case: ' . var_export($data['stringy.isUpperCase'], true)); $output->writeln("Result: {$data['stringy']}"); return 0; }); } }
Run vendor/bin/robo stringy:simple
Output:
Is upper case: false Result: hello_world
Run vendor/bin/robo stringy:simple FOO
Output:
Is upper case: true Result: f_o_o_world