Passed
Pull Request — master (#31)
by Anatoly
39:30
created
src/Header/VaryHeader.php 1 patch
Indentation   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -28,41 +28,41 @@
 block discarded – undo
28 28
 class VaryHeader extends Header
29 29
 {
30 30
 
31
-    /**
32
-     * @var list<string>
33
-     */
34
-    private array $value = [];
31
+	/**
32
+	 * @var list<string>
33
+	 */
34
+	private array $value = [];
35 35
 
36
-    /**
37
-     * Constructor of the class
38
-     *
39
-     * @param string ...$value
40
-     *
41
-     * @throws InvalidHeaderException
42
-     *         If one of the values isn't valid.
43
-     */
44
-    public function __construct(string ...$value)
45
-    {
46
-        $this->validateToken(...$value);
36
+	/**
37
+	 * Constructor of the class
38
+	 *
39
+	 * @param string ...$value
40
+	 *
41
+	 * @throws InvalidHeaderException
42
+	 *         If one of the values isn't valid.
43
+	 */
44
+	public function __construct(string ...$value)
45
+	{
46
+		$this->validateToken(...$value);
47 47
 
48
-        foreach ($value as $item) {
49
-            $this->value[] = $item;
50
-        }
51
-    }
48
+		foreach ($value as $item) {
49
+			$this->value[] = $item;
50
+		}
51
+	}
52 52
 
53
-    /**
54
-     * {@inheritdoc}
55
-     */
56
-    public function getFieldName(): string
57
-    {
58
-        return 'Vary';
59
-    }
53
+	/**
54
+	 * {@inheritdoc}
55
+	 */
56
+	public function getFieldName(): string
57
+	{
58
+		return 'Vary';
59
+	}
60 60
 
61
-    /**
62
-     * {@inheritdoc}
63
-     */
64
-    public function getFieldValue(): string
65
-    {
66
-        return implode(', ', $this->value);
67
-    }
61
+	/**
62
+	 * {@inheritdoc}
63
+	 */
64
+	public function getFieldValue(): string
65
+	{
66
+		return implode(', ', $this->value);
67
+	}
68 68
 }
Please login to merge, or discard this patch.
src/Header/EtagHeader.php 1 patch
Indentation   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -28,39 +28,39 @@
 block discarded – undo
28 28
 class EtagHeader extends Header
29 29
 {
30 30
 
31
-    /**
32
-     * @var string
33
-     */
34
-    private string $value;
31
+	/**
32
+	 * @var string
33
+	 */
34
+	private string $value;
35 35
 
36
-    /**
37
-     * Constructor of the class
38
-     *
39
-     * @param string $value
40
-     *
41
-     * @throws InvalidHeaderException
42
-     *         If the value isn't valid.
43
-     */
44
-    public function __construct(string $value)
45
-    {
46
-        $this->validateQuotedString($value);
36
+	/**
37
+	 * Constructor of the class
38
+	 *
39
+	 * @param string $value
40
+	 *
41
+	 * @throws InvalidHeaderException
42
+	 *         If the value isn't valid.
43
+	 */
44
+	public function __construct(string $value)
45
+	{
46
+		$this->validateQuotedString($value);
47 47
 
48
-        $this->value = $value;
49
-    }
48
+		$this->value = $value;
49
+	}
50 50
 
51
-    /**
52
-     * {@inheritdoc}
53
-     */
54
-    public function getFieldName(): string
55
-    {
56
-        return 'ETag';
57
-    }
51
+	/**
52
+	 * {@inheritdoc}
53
+	 */
54
+	public function getFieldName(): string
55
+	{
56
+		return 'ETag';
57
+	}
58 58
 
59
-    /**
60
-     * {@inheritdoc}
61
-     */
62
-    public function getFieldValue(): string
63
-    {
64
-        return sprintf('"%s"', $this->value);
65
-    }
59
+	/**
60
+	 * {@inheritdoc}
61
+	 */
62
+	public function getFieldValue(): string
63
+	{
64
+		return sprintf('"%s"', $this->value);
65
+	}
66 66
 }
Please login to merge, or discard this patch.
src/Header/ContentRangeHeader.php 2 patches
Indentation   +75 added lines, -75 removed lines patch added patch discarded remove patch
@@ -28,87 +28,87 @@
 block discarded – undo
28 28
 class ContentRangeHeader extends Header
29 29
 {
30 30
 
31
-    /**
32
-     * @var int
33
-     */
34
-    private int $firstBytePosition;
31
+	/**
32
+	 * @var int
33
+	 */
34
+	private int $firstBytePosition;
35 35
 
36
-    /**
37
-     * @var int
38
-     */
39
-    private int $lastBytePosition;
36
+	/**
37
+	 * @var int
38
+	 */
39
+	private int $lastBytePosition;
40 40
 
41
-    /**
42
-     * @var int
43
-     */
44
-    private int $instanceLength;
41
+	/**
42
+	 * @var int
43
+	 */
44
+	private int $instanceLength;
45 45
 
46
-    /**
47
-     * Constructor of the class
48
-     *
49
-     * @param int $firstBytePosition
50
-     * @param int $lastBytePosition
51
-     * @param int $instanceLength
52
-     *
53
-     * @throws InvalidHeaderException
54
-     *         If the range isn't valid.
55
-     */
56
-    public function __construct(int $firstBytePosition, int $lastBytePosition, int $instanceLength)
57
-    {
58
-        $this->validateRange($firstBytePosition, $lastBytePosition, $instanceLength);
46
+	/**
47
+	 * Constructor of the class
48
+	 *
49
+	 * @param int $firstBytePosition
50
+	 * @param int $lastBytePosition
51
+	 * @param int $instanceLength
52
+	 *
53
+	 * @throws InvalidHeaderException
54
+	 *         If the range isn't valid.
55
+	 */
56
+	public function __construct(int $firstBytePosition, int $lastBytePosition, int $instanceLength)
57
+	{
58
+		$this->validateRange($firstBytePosition, $lastBytePosition, $instanceLength);
59 59
 
60
-        $this->firstBytePosition = $firstBytePosition;
61
-        $this->lastBytePosition = $lastBytePosition;
62
-        $this->instanceLength = $instanceLength;
63
-    }
60
+		$this->firstBytePosition = $firstBytePosition;
61
+		$this->lastBytePosition = $lastBytePosition;
62
+		$this->instanceLength = $instanceLength;
63
+	}
64 64
 
65
-    /**
66
-     * {@inheritdoc}
67
-     */
68
-    public function getFieldName(): string
69
-    {
70
-        return 'Content-Range';
71
-    }
65
+	/**
66
+	 * {@inheritdoc}
67
+	 */
68
+	public function getFieldName(): string
69
+	{
70
+		return 'Content-Range';
71
+	}
72 72
 
73
-    /**
74
-     * {@inheritdoc}
75
-     */
76
-    public function getFieldValue(): string
77
-    {
78
-        return sprintf(
79
-            'bytes %d-%d/%d',
80
-            $this->firstBytePosition,
81
-            $this->lastBytePosition,
82
-            $this->instanceLength
83
-        );
84
-    }
73
+	/**
74
+	 * {@inheritdoc}
75
+	 */
76
+	public function getFieldValue(): string
77
+	{
78
+		return sprintf(
79
+			'bytes %d-%d/%d',
80
+			$this->firstBytePosition,
81
+			$this->lastBytePosition,
82
+			$this->instanceLength
83
+		);
84
+	}
85 85
 
86
-    /**
87
-     * Validates the given range
88
-     *
89
-     * @param int $firstBytePosition
90
-     * @param int $lastBytePosition
91
-     * @param int $instanceLength
92
-     *
93
-     * @return void
94
-     *
95
-     * @throws InvalidHeaderException
96
-     *         If the range isn't valid.
97
-     */
98
-    private function validateRange(int $firstBytePosition, int $lastBytePosition, int $instanceLength): void
99
-    {
100
-        if (! ($firstBytePosition <= $lastBytePosition)) {
101
-            throw new InvalidHeaderException(
102
-                'The "first-byte-pos" value of the content range ' .
103
-                'must be less than or equal to the "last-byte-pos" value'
104
-            );
105
-        }
86
+	/**
87
+	 * Validates the given range
88
+	 *
89
+	 * @param int $firstBytePosition
90
+	 * @param int $lastBytePosition
91
+	 * @param int $instanceLength
92
+	 *
93
+	 * @return void
94
+	 *
95
+	 * @throws InvalidHeaderException
96
+	 *         If the range isn't valid.
97
+	 */
98
+	private function validateRange(int $firstBytePosition, int $lastBytePosition, int $instanceLength): void
99
+	{
100
+		if (! ($firstBytePosition <= $lastBytePosition)) {
101
+			throw new InvalidHeaderException(
102
+				'The "first-byte-pos" value of the content range ' .
103
+				'must be less than or equal to the "last-byte-pos" value'
104
+			);
105
+		}
106 106
 
107
-        if (! ($lastBytePosition < $instanceLength)) {
108
-            throw new InvalidHeaderException(
109
-                'The "last-byte-pos" value of the content range ' .
110
-                'must be less than the "instance-length" value'
111
-            );
112
-        }
113
-    }
107
+		if (! ($lastBytePosition < $instanceLength)) {
108
+			throw new InvalidHeaderException(
109
+				'The "last-byte-pos" value of the content range ' .
110
+				'must be less than the "instance-length" value'
111
+			);
112
+		}
113
+	}
114 114
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -97,14 +97,14 @@
 block discarded – undo
97 97
      */
98 98
     private function validateRange(int $firstBytePosition, int $lastBytePosition, int $instanceLength): void
99 99
     {
100
-        if (! ($firstBytePosition <= $lastBytePosition)) {
100
+        if (!($firstBytePosition <= $lastBytePosition)) {
101 101
             throw new InvalidHeaderException(
102 102
                 'The "first-byte-pos" value of the content range ' .
103 103
                 'must be less than or equal to the "last-byte-pos" value'
104 104
             );
105 105
         }
106 106
 
107
-        if (! ($lastBytePosition < $instanceLength)) {
107
+        if (!($lastBytePosition < $instanceLength)) {
108 108
             throw new InvalidHeaderException(
109 109
                 'The "last-byte-pos" value of the content range ' .
110 110
                 'must be less than the "instance-length" value'
Please login to merge, or discard this patch.
src/Header/AgeHeader.php 2 patches
Indentation   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -28,60 +28,60 @@
 block discarded – undo
28 28
 class AgeHeader extends Header
29 29
 {
30 30
 
31
-    /**
32
-     * @var int
33
-     */
34
-    private int $value;
31
+	/**
32
+	 * @var int
33
+	 */
34
+	private int $value;
35 35
 
36
-    /**
37
-     * Constructor of the class
38
-     *
39
-     * @param int $value
40
-     *
41
-     * @throws InvalidHeaderException
42
-     *         If the value isn't valid.
43
-     */
44
-    public function __construct(int $value)
45
-    {
46
-        $this->validateValue($value);
36
+	/**
37
+	 * Constructor of the class
38
+	 *
39
+	 * @param int $value
40
+	 *
41
+	 * @throws InvalidHeaderException
42
+	 *         If the value isn't valid.
43
+	 */
44
+	public function __construct(int $value)
45
+	{
46
+		$this->validateValue($value);
47 47
 
48
-        $this->value = $value;
49
-    }
48
+		$this->value = $value;
49
+	}
50 50
 
51
-    /**
52
-     * {@inheritdoc}
53
-     */
54
-    public function getFieldName(): string
55
-    {
56
-        return 'Age';
57
-    }
51
+	/**
52
+	 * {@inheritdoc}
53
+	 */
54
+	public function getFieldName(): string
55
+	{
56
+		return 'Age';
57
+	}
58 58
 
59
-    /**
60
-     * {@inheritdoc}
61
-     */
62
-    public function getFieldValue(): string
63
-    {
64
-        return sprintf('%d', $this->value);
65
-    }
59
+	/**
60
+	 * {@inheritdoc}
61
+	 */
62
+	public function getFieldValue(): string
63
+	{
64
+		return sprintf('%d', $this->value);
65
+	}
66 66
 
67
-    /**
68
-     * Validates the given value
69
-     *
70
-     * @param int $value
71
-     *
72
-     * @return void
73
-     *
74
-     * @throws InvalidHeaderException
75
-     *         If the value isn't valid.
76
-     */
77
-    private function validateValue(int $value): void
78
-    {
79
-        if (! ($value >= 0)) {
80
-            throw new InvalidHeaderException(sprintf(
81
-                'The value "%2$d" for the header "%1$s" is not valid',
82
-                $this->getFieldName(),
83
-                $value
84
-            ));
85
-        }
86
-    }
67
+	/**
68
+	 * Validates the given value
69
+	 *
70
+	 * @param int $value
71
+	 *
72
+	 * @return void
73
+	 *
74
+	 * @throws InvalidHeaderException
75
+	 *         If the value isn't valid.
76
+	 */
77
+	private function validateValue(int $value): void
78
+	{
79
+		if (! ($value >= 0)) {
80
+			throw new InvalidHeaderException(sprintf(
81
+				'The value "%2$d" for the header "%1$s" is not valid',
82
+				$this->getFieldName(),
83
+				$value
84
+			));
85
+		}
86
+	}
87 87
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -76,7 +76,7 @@
 block discarded – undo
76 76
      */
77 77
     private function validateValue(int $value): void
78 78
     {
79
-        if (! ($value >= 0)) {
79
+        if (!($value >= 0)) {
80 80
             throw new InvalidHeaderException(sprintf(
81 81
                 'The value "%2$d" for the header "%1$s" is not valid',
82 82
                 $this->getFieldName(),
Please login to merge, or discard this patch.
src/Header/AccessControlExposeHeadersHeader.php 1 patch
Indentation   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -28,41 +28,41 @@
 block discarded – undo
28 28
 class AccessControlExposeHeadersHeader extends Header
29 29
 {
30 30
 
31
-    /**
32
-     * @var list<string>
33
-     */
34
-    private array $headers = [];
31
+	/**
32
+	 * @var list<string>
33
+	 */
34
+	private array $headers = [];
35 35
 
36
-    /**
37
-     * Constructor of the class
38
-     *
39
-     * @param string ...$headers
40
-     *
41
-     * @throws InvalidHeaderException
42
-     *         If one of the header names isn't valid.
43
-     */
44
-    public function __construct(string ...$headers)
45
-    {
46
-        $this->validateToken(...$headers);
36
+	/**
37
+	 * Constructor of the class
38
+	 *
39
+	 * @param string ...$headers
40
+	 *
41
+	 * @throws InvalidHeaderException
42
+	 *         If one of the header names isn't valid.
43
+	 */
44
+	public function __construct(string ...$headers)
45
+	{
46
+		$this->validateToken(...$headers);
47 47
 
48
-        foreach ($headers as $header) {
49
-            $this->headers[] = $header;
50
-        }
51
-    }
48
+		foreach ($headers as $header) {
49
+			$this->headers[] = $header;
50
+		}
51
+	}
52 52
 
53
-    /**
54
-     * {@inheritdoc}
55
-     */
56
-    public function getFieldName(): string
57
-    {
58
-        return 'Access-Control-Expose-Headers';
59
-    }
53
+	/**
54
+	 * {@inheritdoc}
55
+	 */
56
+	public function getFieldName(): string
57
+	{
58
+		return 'Access-Control-Expose-Headers';
59
+	}
60 60
 
61
-    /**
62
-     * {@inheritdoc}
63
-     */
64
-    public function getFieldValue(): string
65
-    {
66
-        return implode(', ', $this->headers);
67
-    }
61
+	/**
62
+	 * {@inheritdoc}
63
+	 */
64
+	public function getFieldValue(): string
65
+	{
66
+		return implode(', ', $this->headers);
67
+	}
68 68
 }
Please login to merge, or discard this patch.
src/Header/LinkHeader.php 1 patch
Indentation   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -31,55 +31,55 @@
 block discarded – undo
31 31
 class LinkHeader extends Header
32 32
 {
33 33
 
34
-    /**
35
-     * @var UriInterface
36
-     */
37
-    private UriInterface $uri;
34
+	/**
35
+	 * @var UriInterface
36
+	 */
37
+	private UriInterface $uri;
38 38
 
39
-    /**
40
-     * @var array<string, string>
41
-     */
42
-    private array $parameters;
39
+	/**
40
+	 * @var array<string, string>
41
+	 */
42
+	private array $parameters;
43 43
 
44
-    /**
45
-     * Constructor of the class
46
-     *
47
-     * @param mixed $uri
48
-     * @param array<array-key, mixed> $parameters
49
-     *
50
-     * @throws InvalidUriException
51
-     *         If the URI isn't valid.
52
-     *
53
-     * @throws InvalidHeaderException
54
-     *         If the parameters aren't valid.
55
-     */
56
-    public function __construct($uri, array $parameters = [])
57
-    {
58
-        // validate and normalize the parameters...
59
-        $parameters = $this->validateParameters($parameters);
44
+	/**
45
+	 * Constructor of the class
46
+	 *
47
+	 * @param mixed $uri
48
+	 * @param array<array-key, mixed> $parameters
49
+	 *
50
+	 * @throws InvalidUriException
51
+	 *         If the URI isn't valid.
52
+	 *
53
+	 * @throws InvalidHeaderException
54
+	 *         If the parameters aren't valid.
55
+	 */
56
+	public function __construct($uri, array $parameters = [])
57
+	{
58
+		// validate and normalize the parameters...
59
+		$parameters = $this->validateParameters($parameters);
60 60
 
61
-        $this->uri = Uri::create($uri);
62
-        $this->parameters = $parameters;
63
-    }
61
+		$this->uri = Uri::create($uri);
62
+		$this->parameters = $parameters;
63
+	}
64 64
 
65
-    /**
66
-     * {@inheritdoc}
67
-     */
68
-    public function getFieldName(): string
69
-    {
70
-        return 'Link';
71
-    }
65
+	/**
66
+	 * {@inheritdoc}
67
+	 */
68
+	public function getFieldName(): string
69
+	{
70
+		return 'Link';
71
+	}
72 72
 
73
-    /**
74
-     * {@inheritdoc}
75
-     */
76
-    public function getFieldValue(): string
77
-    {
78
-        $v = sprintf('<%s>', $this->uri->__toString());
79
-        foreach ($this->parameters as $name => $value) {
80
-            $v .= sprintf('; %s="%s"', $name, $value);
81
-        }
73
+	/**
74
+	 * {@inheritdoc}
75
+	 */
76
+	public function getFieldValue(): string
77
+	{
78
+		$v = sprintf('<%s>', $this->uri->__toString());
79
+		foreach ($this->parameters as $name => $value) {
80
+			$v .= sprintf('; %s="%s"', $name, $value);
81
+		}
82 82
 
83
-        return $v;
84
-    }
83
+		return $v;
84
+	}
85 85
 }
Please login to merge, or discard this patch.
src/Header/ContentSecurityPolicyHeader.php 1 patch
Indentation   +62 added lines, -62 removed lines patch added patch discarded remove patch
@@ -29,74 +29,74 @@
 block discarded – undo
29 29
 class ContentSecurityPolicyHeader extends Header
30 30
 {
31 31
 
32
-    /**
33
-     * Regular Expression for a directive name validation
34
-     *
35
-     * @link https://www.w3.org/TR/CSP3/#framework-directives
36
-     *
37
-     * @var string
38
-     */
39
-    public const VALID_DIRECTIVE_NAME = '/^[0-9A-Za-z\-]+$/';
32
+	/**
33
+	 * Regular Expression for a directive name validation
34
+	 *
35
+	 * @link https://www.w3.org/TR/CSP3/#framework-directives
36
+	 *
37
+	 * @var string
38
+	 */
39
+	public const VALID_DIRECTIVE_NAME = '/^[0-9A-Za-z\-]+$/';
40 40
 
41
-    /**
42
-     * Regular Expression for a directive value validation
43
-     *
44
-     * @link https://www.w3.org/TR/CSP3/#framework-directives
45
-     *
46
-     * @var string
47
-     */
48
-    public const VALID_DIRECTIVE_VALUE = '/^[\x09\x20-\x2B\x2D-\x3A\x3C-\x7E]*$/';
41
+	/**
42
+	 * Regular Expression for a directive value validation
43
+	 *
44
+	 * @link https://www.w3.org/TR/CSP3/#framework-directives
45
+	 *
46
+	 * @var string
47
+	 */
48
+	public const VALID_DIRECTIVE_VALUE = '/^[\x09\x20-\x2B\x2D-\x3A\x3C-\x7E]*$/';
49 49
 
50
-    /**
51
-     * @var array<string, string>
52
-     */
53
-    private array $parameters;
50
+	/**
51
+	 * @var array<string, string>
52
+	 */
53
+	private array $parameters;
54 54
 
55
-    /**
56
-     * Constructor of the class
57
-     *
58
-     * @param array<array-key, mixed> $parameters
59
-     *
60
-     * @throws InvalidHeaderException
61
-     *         If the parameters aren't valid.
62
-     */
63
-    public function __construct(array $parameters = [])
64
-    {
65
-        // validate and normalize the parameters...
66
-        $parameters = $this->validateParametersByRegex(
67
-            $parameters,
68
-            self::VALID_DIRECTIVE_NAME,
69
-            self::VALID_DIRECTIVE_VALUE
70
-        );
55
+	/**
56
+	 * Constructor of the class
57
+	 *
58
+	 * @param array<array-key, mixed> $parameters
59
+	 *
60
+	 * @throws InvalidHeaderException
61
+	 *         If the parameters aren't valid.
62
+	 */
63
+	public function __construct(array $parameters = [])
64
+	{
65
+		// validate and normalize the parameters...
66
+		$parameters = $this->validateParametersByRegex(
67
+			$parameters,
68
+			self::VALID_DIRECTIVE_NAME,
69
+			self::VALID_DIRECTIVE_VALUE
70
+		);
71 71
 
72
-        $this->parameters = $parameters;
73
-    }
72
+		$this->parameters = $parameters;
73
+	}
74 74
 
75
-    /**
76
-     * {@inheritdoc}
77
-     */
78
-    public function getFieldName(): string
79
-    {
80
-        return 'Content-Security-Policy';
81
-    }
75
+	/**
76
+	 * {@inheritdoc}
77
+	 */
78
+	public function getFieldName(): string
79
+	{
80
+		return 'Content-Security-Policy';
81
+	}
82 82
 
83
-    /**
84
-     * {@inheritdoc}
85
-     */
86
-    public function getFieldValue(): string
87
-    {
88
-        $directives = [];
89
-        foreach ($this->parameters as $directive => $value) {
90
-            // the directive can be without value,
91
-            // e.g. sandbox, upgrade-insecure-requests, etc.
92
-            if ($value === '') {
93
-                $directives[] = $directive;
94
-                continue;
95
-            }
83
+	/**
84
+	 * {@inheritdoc}
85
+	 */
86
+	public function getFieldValue(): string
87
+	{
88
+		$directives = [];
89
+		foreach ($this->parameters as $directive => $value) {
90
+			// the directive can be without value,
91
+			// e.g. sandbox, upgrade-insecure-requests, etc.
92
+			if ($value === '') {
93
+				$directives[] = $directive;
94
+				continue;
95
+			}
96 96
 
97
-            $directives[] = sprintf('%s %s', $directive, $value);
98
-        }
97
+			$directives[] = sprintf('%s %s', $directive, $value);
98
+		}
99 99
 
100
-        return implode('; ', $directives);
101
-    }
100
+		return implode('; ', $directives);
101
+	}
102 102
 }
Please login to merge, or discard this patch.
src/Header/LocationHeader.php 1 patch
Indentation   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -25,37 +25,37 @@
 block discarded – undo
25 25
 class LocationHeader extends Header
26 26
 {
27 27
 
28
-    /**
29
-     * @var UriInterface
30
-     */
31
-    private UriInterface $uri;
32
-
33
-    /**
34
-     * Constructor of the class
35
-     *
36
-     * @param mixed $uri
37
-     *
38
-     * @throws InvalidUriException
39
-     *         If the URI isn't valid.
40
-     */
41
-    public function __construct($uri)
42
-    {
43
-        $this->uri = Uri::create($uri);
44
-    }
45
-
46
-    /**
47
-     * {@inheritdoc}
48
-     */
49
-    public function getFieldName(): string
50
-    {
51
-        return 'Location';
52
-    }
53
-
54
-    /**
55
-     * {@inheritdoc}
56
-     */
57
-    public function getFieldValue(): string
58
-    {
59
-        return $this->uri->__toString();
60
-    }
28
+	/**
29
+	 * @var UriInterface
30
+	 */
31
+	private UriInterface $uri;
32
+
33
+	/**
34
+	 * Constructor of the class
35
+	 *
36
+	 * @param mixed $uri
37
+	 *
38
+	 * @throws InvalidUriException
39
+	 *         If the URI isn't valid.
40
+	 */
41
+	public function __construct($uri)
42
+	{
43
+		$this->uri = Uri::create($uri);
44
+	}
45
+
46
+	/**
47
+	 * {@inheritdoc}
48
+	 */
49
+	public function getFieldName(): string
50
+	{
51
+		return 'Location';
52
+	}
53
+
54
+	/**
55
+	 * {@inheritdoc}
56
+	 */
57
+	public function getFieldValue(): string
58
+	{
59
+		return $this->uri->__toString();
60
+	}
61 61
 }
Please login to merge, or discard this patch.
src/Header/ContentTypeHeader.php 1 patch
Indentation   +52 added lines, -52 removed lines patch added patch discarded remove patch
@@ -28,64 +28,64 @@
 block discarded – undo
28 28
 class ContentTypeHeader extends Header
29 29
 {
30 30
 
31
-    /**
32
-     * Regular Expression for a content type validation
33
-     *
34
-     * @link https://tools.ietf.org/html/rfc6838#section-4.2
35
-     *
36
-     * @var string
37
-     */
38
-    public const RFC6838_CONTENT_TYPE = '/^[\dA-Za-z][\d\w\!#\$&\+\-\.\^]*(?:\/[\dA-Za-z][\d\w\!#\$&\+\-\.\^]*)?$/';
31
+	/**
32
+	 * Regular Expression for a content type validation
33
+	 *
34
+	 * @link https://tools.ietf.org/html/rfc6838#section-4.2
35
+	 *
36
+	 * @var string
37
+	 */
38
+	public const RFC6838_CONTENT_TYPE = '/^[\dA-Za-z][\d\w\!#\$&\+\-\.\^]*(?:\/[\dA-Za-z][\d\w\!#\$&\+\-\.\^]*)?$/';
39 39
 
40
-    /**
41
-     * @var string
42
-     */
43
-    private string $type;
40
+	/**
41
+	 * @var string
42
+	 */
43
+	private string $type;
44 44
 
45
-    /**
46
-     * @var array<string, string>
47
-     */
48
-    private array $parameters;
45
+	/**
46
+	 * @var array<string, string>
47
+	 */
48
+	private array $parameters;
49 49
 
50
-    /**
51
-     * Constructor of the class
52
-     *
53
-     * @param string $type
54
-     * @param array<array-key, mixed> $parameters
55
-     *
56
-     * @throws InvalidHeaderException
57
-     *         - If the type isn't valid;
58
-     *         - If the parameters aren't valid.
59
-     */
60
-    public function __construct(string $type, array $parameters = [])
61
-    {
62
-        $this->validateValueByRegex(self::RFC6838_CONTENT_TYPE, $type);
50
+	/**
51
+	 * Constructor of the class
52
+	 *
53
+	 * @param string $type
54
+	 * @param array<array-key, mixed> $parameters
55
+	 *
56
+	 * @throws InvalidHeaderException
57
+	 *         - If the type isn't valid;
58
+	 *         - If the parameters aren't valid.
59
+	 */
60
+	public function __construct(string $type, array $parameters = [])
61
+	{
62
+		$this->validateValueByRegex(self::RFC6838_CONTENT_TYPE, $type);
63 63
 
64
-        // validate and normalize the parameters...
65
-        $parameters = $this->validateParameters($parameters);
64
+		// validate and normalize the parameters...
65
+		$parameters = $this->validateParameters($parameters);
66 66
 
67
-        $this->type = $type;
68
-        $this->parameters = $parameters;
69
-    }
67
+		$this->type = $type;
68
+		$this->parameters = $parameters;
69
+	}
70 70
 
71
-    /**
72
-     * {@inheritdoc}
73
-     */
74
-    public function getFieldName(): string
75
-    {
76
-        return 'Content-Type';
77
-    }
71
+	/**
72
+	 * {@inheritdoc}
73
+	 */
74
+	public function getFieldName(): string
75
+	{
76
+		return 'Content-Type';
77
+	}
78 78
 
79
-    /**
80
-     * {@inheritdoc}
81
-     */
82
-    public function getFieldValue(): string
83
-    {
84
-        $v = $this->type;
85
-        foreach ($this->parameters as $name => $value) {
86
-            $v .= sprintf('; %s="%s"', $name, $value);
87
-        }
79
+	/**
80
+	 * {@inheritdoc}
81
+	 */
82
+	public function getFieldValue(): string
83
+	{
84
+		$v = $this->type;
85
+		foreach ($this->parameters as $name => $value) {
86
+			$v .= sprintf('; %s="%s"', $name, $value);
87
+		}
88 88
 
89
-        return $v;
90
-    }
89
+		return $v;
90
+	}
91 91
 }
Please login to merge, or discard this patch.