for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/*
* This file is part of the Koded package.
*
* (c) Mihail Binev <[email protected]>
* Please view the LICENSE distributed with this source code
* for the full copyright and license information.
*/
namespace Koded\Http\Client;
use Koded\Http\Interfaces\HttpStatus;
use Psr\Http\Client\ClientExceptionInterface;
trait EncodingTrait
{
private int $encoding = PHP_QUERY_RFC3986;
public function withEncoding(int $type): static
if (\in_array($type, [0, PHP_QUERY_RFC1738, PHP_QUERY_RFC3986], true)) {
$this->encoding = $type;
return $this;
}
throw new class(
'Invalid encoding type. Expects 0, PHP_QUERY_RFC1738 or PHP_QUERY_RFC3986',
HttpStatus::BAD_REQUEST
) extends \Exception implements ClientExceptionInterface {};