You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+27-1Lines changed: 27 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -32,6 +32,7 @@ Contents
32
32
1.[Filter](#filter)
33
33
1.[Flatten](#flatten)
34
34
1.[IfExists](#ifexists)
35
+
1.[Join](#join)
35
36
1.[Merge](#merge)
36
37
1.[TakeFirst](#takefirst)
37
38
1.[ToList](#tolist)
@@ -294,6 +295,7 @@ The following strategies ship with Mapper and provide a suite of commonly used f
294
295
-[Filter](#filter)– Filters null values or values rejected by the specified callback.
295
296
-[Flatten](#flatten)– Moves all nested values to the top level.
296
297
-[IfExists](#ifexists)– Delegates to one expression or another depending on whether the specified condition maps to null.
298
+
-[Join](#join)– Joins sub-string expressions together with a glue string.
297
299
-[Merge](#merge)– Merges two data sets together giving precedence to the latter if keys collide.
298
300
-[TakeFirst](#takefirst)– Takes the first value from a collection one or more times.
299
301
-[ToList](#tolist)– Converts data to a single-element list unless it is already a list.
@@ -605,6 +607,30 @@ $data = ['foo' => 'foo'];
605
607
606
608
> false
607
609
610
+
### Join
611
+
612
+
Joins sub-string expressions together with a glue string.
613
+
614
+
#### Signature
615
+
616
+
```php
617
+
Join(string $glue, array ...$expressions)
618
+
```
619
+
620
+
1.`$glue`– Glue.
621
+
2.`$expressions`– Sub-string expressions.
622
+
623
+
#### Example
624
+
625
+
```php
626
+
(new Mapper)->map(
627
+
['foo' => 'foo'],
628
+
new Join('-', new Copy('foo'), 'bar')
629
+
);
630
+
```
631
+
632
+
> 'foo-bar'
633
+
608
634
### Merge
609
635
610
636
Merges two data sets together giving precedence to the latter if string keys collide; integer keys never collide. For more information see [array_merge](http://php.net/manual/en/function.array-merge.php).
0 commit comments