mirror of
https://github.com/bitinflow/accounts.git
synced 2026-11-01 13:19:06 +00:00
Refactoring
This commit is contained in:
1 parent
7ba3cdffb0
commit
a2405875ad
26 files changed
+569
-391
No files matched your search
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace Bitinflow\Support;
|
||||
|
||||
class Query
|
||||
{
|
||||
/**
|
||||
* Build query with support for multiple same first-dimension keys.
|
||||
*
|
||||
* @param array $query
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function build(array $query): string
|
||||
{
|
||||
$parts = [];
|
||||
foreach ($query as $name => $value) {
|
||||
$value = (array)$value;
|
||||
array_walk_recursive($value, function ($value) use (&$parts, $name) {
|
||||
$parts[] = urlencode($name) . '=' . urlencode($value);
|
||||
});
|
||||
}
|
||||
|
||||
return implode('&', $parts);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user