Skip to content

Commit ae055cb

Browse files
minworkgitbook-bot
authored andcommitted
GitBook: [master] 3 pages modified
1 parent 28cd7f0 commit ae055cb

File tree

3 files changed

+43
-0
lines changed

3 files changed

+43
-0
lines changed

docs/SUMMARY.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@
1111
* [clone](common-methods/clone.md)
1212
* [getKeysArray](common-methods/getkeysarray.md)
1313

14+
## Object oriented methods
15+
16+
* [General information](object-oriented-methods/general-information.md)
17+
1418
## Validating array
1519

1620
* [check](validating-array/check.md)
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# General information
2+
3+
### Object creating
4+
5+
You can create `ArrObj` by calling
6+
7+
```php
8+
new ArrObj(array|ArrayAccess $array = [])
9+
10+
// Or for easier chaining
11+
Arr::obj(array|ArrayAccess $array = [])
12+
```
13+
14+
### Chaining
15+
16+
For chaining just call standard `Arr` methods without first parameter \(array or ArrayAccess object\).
17+
18+
As a convenience `ArrObj` contains PHPDoc definitions for every available method, so you don't need to guess their parameters and quickly jump to the corresponding `Arr` method.
19+
20+
To obtain array from object just call `getArray()` as the final method of a chain.
21+
22+
### Examples
23+
24+
```php
25+
// Chain setting nested array values
26+
Arr::obj()->set('foo', 'bar')->set('test.[]', 'test')->getArray() ->
27+
[
28+
'foo' => 'bar',
29+
'test' => ['test']
30+
]
31+
32+
// Quickly flatten array of objects grouped by id
33+
Arr::obj([...])->groupObjects('getId')->flattenSingle()->getArray()
34+
```
35+
36+
37+

docs/validating-array/check.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@
22

33
#### Definition
44

5+
{% code title="" %}
56
```php
67
Arr::check(array $array, mixed|callable $condition, bool $strict = false): bool
78
```
9+
{% endcode %}
810

911
#### Description
1012

0 commit comments

Comments
 (0)