Skip to content

Commit

Permalink
Cleanup parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
adbario committed Mar 25, 2022
1 parent 00d69fe commit 3857c8c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Dot.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ class Dot implements ArrayAccess, Countable, IteratorAggregate, JsonSerializable
public function __construct($items = [], $parse = false)
{
$items = $this->getArrayItems($items);
if ($parse === true) {
$this->set($items);
return;

if ($parse) {
return $this->set($items);
}

$this->items = $items;
Expand Down
3 changes: 3 additions & 0 deletions tests/DotTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,11 @@ public function testConstructHelper()
public function testConstructWithParsing()
{
$dot = new Dot(['foo.bar' => 'baz']);

$this->assertEquals(['foo.bar' => 'baz'], $dot->get());

$dot = new Dot(['foo.bar' => 'baz'], true);

$this->assertEquals(['foo' => ['bar' => 'baz']], $dot->get());
}

Expand Down

0 comments on commit 3857c8c

Please sign in to comment.