Code Coverage
 
Classes and Traits
Functions and Methods
Lines
Total
0.00% covered (danger)
0.00%
0 / 1
10.34% covered (danger)
10.34%
3 / 29
CRAP
11.86% covered (danger)
11.86%
7 / 59
HttpOptions
0.00% covered (danger)
0.00%
0 / 1
10.34% covered (danger)
10.34%
3 / 29
646.16
11.86% covered (danger)
11.86%
7 / 59
 toArray
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
 setAuthBasic
100.00% covered (success)
100.00%
1 / 1
2
100.00% covered (success)
100.00%
4 / 4
 setAuthBearer
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
2 / 2
 setQuery
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 2
 setHeaders
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 2
 setBody
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 2
 setJson
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 2
 setUserData
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 2
 setMaxRedirects
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 2
 setHttpVersion
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 2
 setBaseUri
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 2
 buffer
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 2
 setOnProgress
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 2
 resolve
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 2
 setProxy
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 2
 setNoProxy
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 2
 setTimeout
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 2
 bindTo
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 2
 verifyPeer
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 2
 verifyHost
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 2
 setCaFile
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 2
 setCaPath
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 2
 setLocalCert
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 2
 setLocalPk
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 2
 setPassphrase
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 2
 setCiphers
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 2
 setPeerFingerprint
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 2
 capturePeerCertChain
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 2
 setExtra
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 2
<?php
/*
 * This file is part of the Symfony package.
 *
 * (c) Fabien Potencier <fabien@symfony.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
namespace Symfony\Component\HttpClient;
use Symfony\Contracts\HttpClient\HttpClientInterface;
/**
 * A helper providing autocompletion for available options.
 *
 * @see HttpClientInterface for a description of each options.
 *
 * @author Nicolas Grekas <p@tchwork.com>
 */
class HttpOptions
{
    private $options = [];
    public function toArray(): array
    {
        return $this->options;
    }
    /**
     * @return $this
     */
    public function setAuthBasic(string $user, string $password = '')
    {
        $this->options['auth_basic'] = $user;
        if ('' !== $password) {
            $this->options['auth_basic'] .= ':'.$password;
        }
        return $this;
    }
    /**
     * @return $this
     */
    public function setAuthBearer(string $token)
    {
        $this->options['auth_bearer'] = $token;
        return $this;
    }
    /**
     * @return $this
     */
    public function setQuery(array $query)
    {
        $this->options['query'] = $query;
        return $this;
    }
    /**
     * @return $this
     */
    public function setHeaders(iterable $headers)
    {
        $this->options['headers'] = $headers;
        return $this;
    }
    /**
     * @param array|string|resource|\Traversable|\Closure $body
     *
     * @return $this
     */
    public function setBody($body)
    {
        $this->options['body'] = $body;
        return $this;
    }
    /**
     * @param mixed $json
     *
     * @return $this
     */
    public function setJson($json)
    {
        $this->options['json'] = $json;
        return $this;
    }
    /**
     * @return $this
     */
    public function setUserData($data)
    {
        $this->options['user_data'] = $data;
        return $this;
    }
    /**
     * @return $this
     */
    public function setMaxRedirects(int $max)
    {
        $this->options['max_redirects'] = $max;
        return $this;
    }
    /**
     * @return $this
     */
    public function setHttpVersion(string $version)
    {
        $this->options['http_version'] = $version;
        return $this;
    }
    /**
     * @return $this
     */
    public function setBaseUri(string $uri)
    {
        $this->options['base_uri'] = $uri;
        return $this;
    }
    /**
     * @return $this
     */
    public function buffer(bool $buffer)
    {
        $this->options['buffer'] = $buffer;
        return $this;
    }
    /**
     * @return $this
     */
    public function setOnProgress(callable $callback)
    {
        $this->options['on_progress'] = $callback;
        return $this;
    }
    /**
     * @return $this
     */
    public function resolve(array $hostIps)
    {
        $this->options['resolve'] = $hostIps;
        return $this;
    }
    /**
     * @return $this
     */
    public function setProxy(string $proxy)
    {
        $this->options['proxy'] = $proxy;
        return $this;
    }
    /**
     * @return $this
     */
    public function setNoProxy(string $noProxy)
    {
        $this->options['no_proxy'] = $noProxy;
        return $this;
    }
    /**
     * @return $this
     */
    public function setTimeout(float $timeout)
    {
        $this->options['timeout'] = $timeout;
        return $this;
    }
    /**
     * @return $this
     */
    public function bindTo(string $bindto)
    {
        $this->options['bindto'] = $bindto;
        return $this;
    }
    /**
     * @return $this
     */
    public function verifyPeer(bool $verify)
    {
        $this->options['verify_peer'] = $verify;
        return $this;
    }
    /**
     * @return $this
     */
    public function verifyHost(bool $verify)
    {
        $this->options['verify_host'] = $verify;
        return $this;
    }
    /**
     * @return $this
     */
    public function setCaFile(string $cafile)
    {
        $this->options['cafile'] = $cafile;
        return $this;
    }
    /**
     * @return $this
     */
    public function setCaPath(string $capath)
    {
        $this->options['capath'] = $capath;
        return $this;
    }
    /**
     * @return $this
     */
    public function setLocalCert(string $cert)
    {
        $this->options['local_cert'] = $cert;
        return $this;
    }
    /**
     * @return $this
     */
    public function setLocalPk(string $pk)
    {
        $this->options['local_pk'] = $pk;
        return $this;
    }
    /**
     * @return $this
     */
    public function setPassphrase(string $passphrase)
    {
        $this->options['passphrase'] = $passphrase;
        return $this;
    }
    /**
     * @return $this
     */
    public function setCiphers(string $ciphers)
    {
        $this->options['ciphers'] = $ciphers;
        return $this;
    }
    /**
     * @param string|array $fingerprint
     *
     * @return $this
     */
    public function setPeerFingerprint($fingerprint)
    {
        $this->options['peer_fingerprint'] = $fingerprint;
        return $this;
    }
    /**
     * @return $this
     */
    public function capturePeerCertChain(bool $capture)
    {
        $this->options['capture_peer_cert_chain'] = $capture;
        return $this;
    }
    /**
     * @return $this
     */
    public function setExtra(string $name, $value)
    {
        $this->options['extra'][$name] = $value;
        return $this;
    }
}