mirror of
https://github.com/retailcrm/mailgun-php.git
synced 2024-11-23 13:06:02 +03:00
28 lines
628 B
PHP
28 lines
628 B
PHP
<?php
|
|
|
|
namespace Guzzle\Http\QueryAggregator;
|
|
|
|
use Guzzle\Http\QueryString;
|
|
|
|
/**
|
|
* Aggregates nested query string variables using PHP style []
|
|
*/
|
|
class PhpAggregator implements QueryAggregatorInterface
|
|
{
|
|
public function aggregate($key, $value, QueryString $query)
|
|
{
|
|
$ret = array();
|
|
|
|
foreach ($value as $k => $v) {
|
|
$k = "{$key}[{$k}]";
|
|
if (is_array($v)) {
|
|
$ret = array_merge($ret, self::aggregate($k, $v, $query));
|
|
} else {
|
|
$ret[$query->encodeValue($k)] = $query->encodeValue($v);
|
|
}
|
|
}
|
|
|
|
return $ret;
|
|
}
|
|
}
|