Completed
Push — master ( 039dcf...417ea8 )
by Maik
03:08
created

HttpsClient::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 11
Code Lines 8

Duplication

Lines 11
Ratio 100 %

Code Coverage

Tests 9
CRAP Score 1

Importance

Changes 0
Metric Value
dl 11
loc 11
ccs 9
cts 9
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 8
nc 1
nop 3
crap 1
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 12 View Code Duplication
    public function __construct(Url $url, $proto = 'HTTP/1.1', $timeout = 10)
33
    {
34 12
        parent::__construct($url);
35
        
36 12
        $this->setTimeout($timeout);
37 12
        $this->setPath($url->getPath());
38 12
        $this->setProtocol($proto);
39 12
        $this->setQueryString($url->getQueryString());
40 12
        $this->reset();
41 12
        $this->resetHeaders();
42 12
    }
43
    
44
    /**
45
     *
46
     * {@inheritdoc}
47
     * @see \Generics\Streams\HttpStream::request()
48
     */
49 11
    public function request(string $requestType)
50
    {
51 11
        $this->requestImpl($requestType);
52
    }
53
}