Total Complexity | 3 |
Total Lines | 46 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php declare(strict_types=1); |
||
23 | class ContentMD5Header extends Header |
||
24 | { |
||
25 | |||
26 | /** |
||
27 | * Regular Expression for a MD5 digest validation |
||
28 | * |
||
29 | * @link https://tools.ietf.org/html/rfc2045#section-6.8 |
||
30 | * |
||
31 | * @var string |
||
32 | */ |
||
33 | public const RFC2045_MD5_DIGEST = '/^[A-Za-z0-9\+\/]+=*$/'; |
||
34 | |||
35 | /** |
||
36 | * @var string |
||
37 | */ |
||
38 | private string $value; |
||
39 | |||
40 | /** |
||
41 | * Constructor of the class |
||
42 | * |
||
43 | * @param string $value |
||
44 | * |
||
45 | * @throws InvalidHeaderValueException |
||
46 | * If the value isn't valid. |
||
47 | */ |
||
48 | 7 | public function __construct(string $value) |
|
49 | { |
||
50 | 7 | $this->validateValueByRegex(self::RFC2045_MD5_DIGEST, $value); |
|
51 | |||
52 | 5 | $this->value = $value; |
|
53 | } |
||
54 | |||
55 | /** |
||
56 | * {@inheritdoc} |
||
57 | */ |
||
58 | 5 | public function getFieldName(): string |
|
61 | } |
||
62 | |||
63 | /** |
||
64 | * {@inheritdoc} |
||
65 | */ |
||
66 | 3 | public function getFieldValue(): string |
|
69 | } |
||
70 | } |
||
71 |