Skip to content

Commit 3857c8c

Browse files
committed
Cleanup parsing
1 parent 00d69fe commit 3857c8c

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

Diff for: src/Dot.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ class Dot implements ArrayAccess, Countable, IteratorAggregate, JsonSerializable
3838
public function __construct($items = [], $parse = false)
3939
{
4040
$items = $this->getArrayItems($items);
41-
if ($parse === true) {
42-
$this->set($items);
43-
return;
41+
42+
if ($parse) {
43+
return $this->set($items);
4444
}
4545

4646
$this->items = $items;

Diff for: tests/DotTest.php

+3
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,11 @@ public function testConstructHelper()
5959
public function testConstructWithParsing()
6060
{
6161
$dot = new Dot(['foo.bar' => 'baz']);
62+
6263
$this->assertEquals(['foo.bar' => 'baz'], $dot->get());
64+
6365
$dot = new Dot(['foo.bar' => 'baz'], true);
66+
6467
$this->assertEquals(['foo' => ['bar' => 'baz']], $dot->get());
6568
}
6669

0 commit comments

Comments
 (0)