Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 3c0bfc6

Browse files
committed
feat: add getArray to std collection
1 parent a7048ea commit 3c0bfc6

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

‎src/Std/Collection.php‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,19 @@ public function getString(string $key, string $default = ''): string
158158
return $default;
159159
}
160160

161+
/**
162+
* @param string $key
163+
* @param array $default
164+
*
165+
* @return array
166+
*/
167+
public function getArray(string $key, array $default = []): array
168+
{
169+
$data = $this->get($key);
170+
171+
return $data ? (array)$data : $default;
172+
}
173+
161174
/**
162175
* Add item to collection
163176
*

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /