Completed
Push — master ( 83653b...4aa32c )
by Dev
02:17
created

MultipleCheckInHeaders   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 9
dl 0
loc 19
ccs 8
cts 8
cp 1
rs 10
c 0
b 0
f 0
wmc 4

2 Methods

Rating   Name   Duplication   Size   Complexity  
A check() 0 7 3
A __construct() 0 4 1
1
<?php
2
3
namespace PiedWeb\Curl;
4
5
/**
6
 * This class is an example.
7
 */
8
class MultipleCheckInHeaders
9
{
10
    protected $expectedCode;
11
    protected $expectedType;
12
    protected $code;
13
14 6
    public function __construct(int $expectedCode = 200, string $expectedType = 'text/html')
15
    {
16 6
        $this->expectedCode = $expectedCode;
17 6
        $this->expectedType = $expectedType;
18 6
    }
19
20 6
    public function check($line)
21
    {
22 6
        if (Helper::checkStatusCode($line, $this->expectedCode)) {
23 3
            $this->code = 200;
24
        }
25
26 6
        return 200 == $this->code && Helper::checkContentType($line, $this->expectedType);
27
    }
28
}
29