Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Separate chain calls #80

Merged
merged 1 commit into from
Jun 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,9 @@ The following methods are available:
## Inflector usage

```php
echo (new \Yiisoft\Strings\Inflector())->withoutIntl()->toSlug('Strings are cool!'); // strings-are-cool
echo (new \Yiisoft\Strings\Inflector())
->withoutIntl()
->toSlug('Strings are cool!'); // strings-are-cool
```

Overall the inflector has the following method groups.
Expand Down Expand Up @@ -171,7 +173,9 @@ The following characters are special in the pattern:
use \Yiisoft\Strings\WildcardPattern;

$startsWithTest = new WildcardPattern('test*');
if ($startsWithTest->ignoreCase()->match('tEStIfThisIsTrue')) {
if ($startsWithTest
->ignoreCase()
->match('tEStIfThisIsTrue')) {
echo 'It starts with "test"!';
}
```
Expand Down
20 changes: 12 additions & 8 deletions tests/InflectorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,9 @@ public function testToSlugCommons(string $input, string $expected, string $repla
if (\extension_loaded('intl')) {
$this->assertEquals($expected, $inflector->toSlug($input, $replacement));
}
$this->assertEquals($expected, $inflector->withoutIntl()->toSlug($input, $replacement));
$this->assertEquals($expected, $inflector
->withoutIntl()
->toSlug($input, $replacement));
}

public function testToSlugWithIntl(): void
Expand Down Expand Up @@ -403,13 +405,15 @@ public function testToTransliteratedWithTransliterationMap(): void
$this->markTestSkipped('intl extension is required.');
}

$inflector = (new Inflector())->withoutIntl()->withTransliterationMap(
[
'O' => 'E',
'N' => 'N',
'E' => 'O',
]
);
$inflector = (new Inflector())
->withoutIntl()
->withTransliterationMap(
[
'O' => 'E',
'N' => 'N',
'E' => 'O',
]
);
$this->assertEquals('ENO', $inflector->toTransliterated('ONE'));
}

Expand Down