Skip to content

Commit cc79fc4

Browse files
committed
Improve docs
1 parent a1b4b37 commit cc79fc4

File tree

1 file changed

+10
-12
lines changed

1 file changed

+10
-12
lines changed

src/Web/Documentation/content/main/1-framework/15-primitive-utilities.md

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,19 @@ Tempest comes with a handful of classes that improve working with primitive type
77

88
## Strings
99

10-
The `StringHelper` class wraps a normal string, and provides a fluent API to manipulate that string. Note that all these methods are immutable, so every call creates a new instance of `StringHelper` without modifying the original one.
10+
The `ImmutableString` and `MutableString` classes wraps a normal string, and provide a fluent API to manipulate that string.
1111

1212
```php
13-
use Tempest\Support\StringHelper;
13+
use Tempest\Support\Str\ImmutableString;
1414

15-
$slug = (new StringHelper('https://tempestphp.com/docs/framework/14-primitive-helpers'))
15+
$slug = (new ImmutableString('https://tempestphp.com/docs/framework/14-primitive-helpers'))
1616
->trim('/')
1717
->afterLast('/')
1818
->replaceRegex('/\d+-/', '')
1919
->toString();
20-
21-
// primitive-helpers
2220
```
2321

24-
Note that you can also use the `str()` helper function instead of manually creating a `StringHelper` object:
22+
Note that you can also use the `str()` helper function, which is a shorthand for `ImmutableString`:
2523

2624
```php
2725
use function Tempest\Support\str;
@@ -33,24 +31,24 @@ if (! $path->startsWith('/docs')) {
3331
}
3432
```
3533

36-
The `StringHelper` encapsulates many of PHP's built-in string functions, as well as several regex-based functions. You can check out the [full API on GitHub](https://github.com/tempestphp/tempest-framework/blob/main/src/Tempest/Support/src/StringHelper.php).
34+
These string helpers encapsulate many of PHP's built-in string functions, as well as several regex-based functions. You can check out the [full API on GitHub](https://github.com/tempestphp/tempest-framework/blob/main/src/Tempest/Support/src/Str/ManipulatesString.php).
3735

3836
## Arrays
3937

40-
The `ArrayHelper` class wraps a normal array, and provides a fluent API to manipulate it. Note that all these methods are immutable, so every call creates a new instance of `ArrayHelper` without modifying the original one.
38+
The `ImmutableArray` and `MutableArray` classes wrap an array, and provide a fluent API to manipulate it.
4139

4240
```php
43-
use Tempest\Support\ArrayHelper;
41+
use Tempest\Support\Arr\ImmutableArray;
4442

45-
$items = (new ArrayHelper(glob(__DIR__ . '/Content/*.md')))
43+
$items = (new ImmutableArray(glob(__DIR__ . '/Content/*.md')))
4644
->reverse()
4745
->map(function (string $path) {
4846
// …
4947
})
5048
->mapTo(BlogPost::class);
5149
```
5250

53-
Note that you can also use the `arr()` helper function instead of manually creating a `ArrayHelper` object:
51+
Note that you can also use the `arr()` helper function instead of manually creating an `ImmutableArray` object:
5452

5553
```php
5654
use function Tempest\Support\arr;
@@ -66,7 +64,7 @@ $codeBlocks = arr(glob(__DIR__ . '/*.md'))
6664
->toArray();
6765
```
6866

69-
You can check out the [full API on GitHub](https://github.com/tempestphp/tempest-framework/blob/main/src/Tempest/Support/src/ArrayHelper.php).
67+
You can check out the [full API on GitHub](https://github.com/tempestphp/tempest-framework/blob/main/src/Tempest/Support/src/Arr/ManipulatesArray.php).
7068

7169
## Enums
7270

0 commit comments

Comments
 (0)