Completed
Push — master ( 9cb483...15ad7c )
by Maik
03:24
created

HttpsClient::request()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
crap 1
1
<?php
2
namespace Generics\Client;
3
4
use Generics\Socket\Url;
5
use Generics\Socket\SecureClientSocket;
6
use Generics\Streams\HttpStream;
7
8
class HttpsClient extends SecureClientSocket implements HttpStream
9
{
10
    use HttpClientTrait;
11
    
12
    /**
13
     * Create a new https client
14
     *
15
     * @param Url $url
16
     *            The url for http request
17
     * @param string $proto
18
     *            The protocol to use (default = HTTP/1.1)
19
     * @param integer $timeout
20
     *            Optional timeout for request (default = 10 seconds)
21
     */
22 11 View Code Duplication
    public function __construct(Url $url, $proto = 'HTTP/1.1', $timeout = 10)
23
    {
24 11
        parent::__construct($url);
25
        
26 11
        $this->setTimeout($timeout);
27 11
        $this->setPath($url->getPath());
28 11
        $this->setProtocol($proto);
29 11
        $this->setQueryString($url->getQueryString());
30 11
        $this->reset();
31 11
        $this->resetHeaders();
32 11
    }
33
    
34
    /**
35
     *
36
     * {@inheritdoc}
37
     * @see \Generics\Streams\HttpStream::request()
38
     */
39 11
    public function request(string $requestType)
40
    {
41 11
        $this->requestImpl($requestType);
42
    }
43
}