|
1
|
|
|
<?php declare(strict_types=1); |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* It's free open-source software released under the MIT License. |
|
5
|
|
|
* |
|
6
|
|
|
* @author Anatoly Nekhay <[email protected]> |
|
7
|
|
|
* @copyright Copyright (c) 2018, Anatoly Nekhay |
|
8
|
|
|
* @license https://github.com/sunrise-php/http-message/blob/master/LICENSE |
|
9
|
|
|
* @link https://github.com/sunrise-php/http-message |
|
10
|
|
|
*/ |
|
11
|
|
|
|
|
12
|
|
|
namespace Sunrise\Http\Message\Header; |
|
13
|
|
|
|
|
14
|
|
|
/** |
|
15
|
|
|
* Import classes |
|
16
|
|
|
*/ |
|
17
|
|
|
use Sunrise\Http\Message\Exception\InvalidHeaderValueException; |
|
18
|
|
|
use Sunrise\Http\Message\Header; |
|
19
|
|
|
|
|
20
|
|
|
/** |
|
21
|
|
|
* Import functions |
|
22
|
|
|
*/ |
|
23
|
|
|
use function implode; |
|
24
|
|
|
|
|
25
|
|
|
/** |
|
26
|
|
|
* @link https://tools.ietf.org/html/rfc2616#section-14.11 |
|
27
|
|
|
*/ |
|
28
|
|
|
class ContentEncodingHeader extends Header |
|
29
|
|
|
{ |
|
30
|
|
|
|
|
31
|
|
|
/** |
|
32
|
|
|
* Directives |
|
33
|
|
|
* |
|
34
|
|
|
* @var string |
|
35
|
|
|
*/ |
|
36
|
|
|
public const GZIP = 'gzip'; |
|
37
|
|
|
public const COMPRESS = 'compress'; |
|
38
|
|
|
public const DEFLATE = 'deflate'; |
|
39
|
|
|
public const BR = 'br'; |
|
40
|
|
|
|
|
41
|
|
|
/** |
|
42
|
|
|
* @var list<string> |
|
|
|
|
|
|
43
|
|
|
*/ |
|
44
|
|
|
private array $directives; |
|
45
|
|
|
|
|
46
|
|
|
/** |
|
47
|
|
|
* Constructor of the class |
|
48
|
|
|
* |
|
49
|
|
|
* @param string ...$directives |
|
50
|
|
|
* |
|
51
|
|
|
* @throws InvalidHeaderValueException |
|
52
|
|
|
* If one of the directives isn't valid. |
|
53
|
|
|
*/ |
|
54
|
10 |
|
public function __construct(string ...$directives) |
|
55
|
|
|
{ |
|
56
|
|
|
/** @var list<string> $directives */ |
|
57
|
|
|
|
|
58
|
10 |
|
$this->validateToken(...$directives); |
|
59
|
|
|
|
|
60
|
6 |
|
$this->directives = $directives; |
|
61
|
|
|
} |
|
62
|
|
|
|
|
63
|
|
|
/** |
|
64
|
|
|
* {@inheritdoc} |
|
65
|
|
|
*/ |
|
66
|
7 |
|
public function getFieldName(): string |
|
67
|
|
|
{ |
|
68
|
7 |
|
return 'Content-Encoding'; |
|
69
|
|
|
} |
|
70
|
|
|
|
|
71
|
|
|
/** |
|
72
|
|
|
* {@inheritdoc} |
|
73
|
|
|
*/ |
|
74
|
4 |
|
public function getFieldValue(): string |
|
75
|
|
|
{ |
|
76
|
4 |
|
return implode(', ', $this->directives); |
|
77
|
|
|
} |
|
78
|
|
|
} |
|
79
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths