An open API service indexing awesome lists of open source software.

https://github.com/sweetchuck/robo-stringy


https://github.com/sweetchuck/robo-stringy

robo-task string-manipulation stringy

Last synced: 5 months ago
JSON representation

Awesome Lists containing this project

README

          

# Robo Stringy

[![CircleCI](https://circleci.com/gh/Sweetchuck/robo-stringy/tree/2.x.svg?style=svg)](https://circleci.com/gh/Sweetchuck/robo-stringy/?branch=2.x)
[![codecov](https://codecov.io/gh/Sweetchuck/robo-stringy/branch/2.x/graph/badge.svg?token=HSF16OGPyr)](https://app.codecov.io/gh/Sweetchuck/robo-stringy/branch/2.x)

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
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