Skip to content

Commit

Permalink
return default value if key not supplied, totally my idea
Browse files Browse the repository at this point in the history
  • Loading branch information
Andy Vaughn committed Jan 22, 2019
1 parent bf2deff commit 055c42c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/XArray.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ public function getAll(string $key = '', array $default = []) : ?array {
public function getVal(string $key, $default = null) {
$array = $this->array;
if($key === '') {
return null;
return $default;
}
$keys = explode('/', $key);
$count = count($keys);
Expand Down

1 comment on commit 055c42c

@yurigorokhov
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great idea @modethirteen. This will save us so many bugs in the future.

Please sign in to comment.