Completed
Push — master ( 9d0a53...ecd7bc )
by Maik
01:48
created

HttpsClient::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 11
Code Lines 8

Duplication

Lines 11
Ratio 100 %

Code Coverage

Tests 0
CRAP Score 2

Importance

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