Skip to content

Commit d938a67

Browse files
Restored old QueryStringBuilder and mark as deprecated
1 parent 11c6119 commit d938a67

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
<?php
2+
3+
namespace Gitlab\HttpClient\Message;
4+
5+
use Gitlab\HttpClient\Util\QueryStringBuilder as UtilQueryStringBuilder;
6+
7+
/**
8+
* @deprecated since 9.18 and will be removed in 10.0.
9+
*/
10+
final class QueryStringBuilder
11+
{
12+
/**
13+
* Encode a query as a query string according to RFC 3986. Indexed arrays are encoded using
14+
* empty squared brackets ([]) unlike http_build_query.
15+
*
16+
* @param mixed $query
17+
*
18+
* @return string
19+
*
20+
* @deprecated since 9.18 and will be removed in 10.0.
21+
*/
22+
public static function build($query)
23+
{
24+
@trigger_error(sprintf('The %s() method is deprecated since version 9.18 and will be removed in 10.0.', __METHOD__), E_USER_DEPRECATED);
25+
26+
return UtilQueryStringBuilder::build($query);
27+
}
28+
29+
/**
30+
* Tell if the given array is an indexed one (i.e. contains only sequential integer keys starting from 0).
31+
*
32+
* @param array $query
33+
*
34+
* @return bool
35+
*
36+
* @deprecated since 9.18 and will be removed in 10.0.
37+
*/
38+
public static function isIndexedArray(array $query)
39+
{
40+
@trigger_error(sprintf('The %s() method is deprecated since version 9.18 and will be removed in 10.0.', __METHOD__), E_USER_DEPRECATED);
41+
42+
if (0 === count($query) || !isset($query[0])) {
43+
return false;
44+
}
45+
46+
return array_keys($query) === range(0, count($query) - 1);
47+
}
48+
}

0 commit comments

Comments
 (0)