Skip to content

Commit 333c227

Browse files
authored
Update Config.php
1 parent d706a6d commit 333c227

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/Config.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,15 +66,16 @@ public function offsetGet($offset): mixed
6666
}
6767

6868
/**
69-
* @param $offset
70-
* @param null $default
71-
* @param bool $invoke
7269
* @return self|null|mixed
7370
*/
74-
public function get($offset, $default = null, bool $invoke = true)
71+
public function get($offset, mixed $default = null, bool $invoke = true, bool $toArray = false)
7572
{
76-
return $this->offsetExists($offset) ? $this->data[$offset]
73+
$data = $this->offsetExists($offset) ? $this->data[$offset]
7774
: ($invoke && is_callable($default) ? $default() : $default);
75+
76+
if ($toArray && $data instanceof Arrayable) return $data->toArray();
77+
78+
return $data;
7879
}
7980

8081
/**

0 commit comments

Comments
 (0)