Skip to content

Commit 79daab3

Browse files
committed
Adding delimiter for helper, documentation
1 parent 7777aea commit 79daab3

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,15 @@ $dot = dot();
6767
$dot = dot($array);
6868
```
6969

70+
It is possible use an alternative delimiter from the default dot (`.`) with the second constructor parameter. Using an underscore instead:
71+
72+
```php
73+
$dot = new \Adbar\Dot($array, '_');
74+
75+
// With the helper
76+
$dot = dot($array, '_');
77+
```
78+
7079
## Methods
7180

7281
Dot has the following methods:

src/helpers.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,14 @@
1111

1212
if (! function_exists('dot')) {
1313
/**
14-
* Create a new Dot object with the given items
14+
* Create a new Dot object with the given items and optional delimiter
1515
*
16-
* @param mixed $items
16+
* @param mixed $items
17+
* @param string $delimiter
1718
* @return \Adbar\Dot
1819
*/
19-
function dot($items)
20+
function dot($items, $delimiter = '.')
2021
{
21-
return new Dot($items);
22+
return new Dot($items, $delimiter);
2223
}
2324
}

0 commit comments

Comments
 (0)