Passed
Push — master ( cd6ebd...24ee82 )
by Anatoly
07:49 queued 03:36
created
src/Header/ExpiresHeader.php 1 patch
Indentation   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -24,34 +24,34 @@
 block discarded – undo
24 24
 class ExpiresHeader extends Header
25 25
 {
26 26
 
27
-    /**
28
-     * @var DateTimeInterface
29
-     */
30
-    private DateTimeInterface $timestamp;
31
-
32
-    /**
33
-     * Constructor of the class
34
-     *
35
-     * @param DateTimeInterface $timestamp
36
-     */
37
-    public function __construct(DateTimeInterface $timestamp)
38
-    {
39
-        $this->timestamp = $timestamp;
40
-    }
41
-
42
-    /**
43
-     * {@inheritdoc}
44
-     */
45
-    public function getFieldName(): string
46
-    {
47
-        return 'Expires';
48
-    }
49
-
50
-    /**
51
-     * {@inheritdoc}
52
-     */
53
-    public function getFieldValue(): string
54
-    {
55
-        return $this->formatDateTime($this->timestamp);
56
-    }
27
+	/**
28
+	 * @var DateTimeInterface
29
+	 */
30
+	private DateTimeInterface $timestamp;
31
+
32
+	/**
33
+	 * Constructor of the class
34
+	 *
35
+	 * @param DateTimeInterface $timestamp
36
+	 */
37
+	public function __construct(DateTimeInterface $timestamp)
38
+	{
39
+		$this->timestamp = $timestamp;
40
+	}
41
+
42
+	/**
43
+	 * {@inheritdoc}
44
+	 */
45
+	public function getFieldName(): string
46
+	{
47
+		return 'Expires';
48
+	}
49
+
50
+	/**
51
+	 * {@inheritdoc}
52
+	 */
53
+	public function getFieldValue(): string
54
+	{
55
+		return $this->formatDateTime($this->timestamp);
56
+	}
57 57
 }
Please login to merge, or discard this patch.
src/Header/DateHeader.php 1 patch
Indentation   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -24,34 +24,34 @@
 block discarded – undo
24 24
 class DateHeader extends Header
25 25
 {
26 26
 
27
-    /**
28
-     * @var DateTimeInterface
29
-     */
30
-    private DateTimeInterface $timestamp;
31
-
32
-    /**
33
-     * Constructor of the class
34
-     *
35
-     * @param DateTimeInterface $timestamp
36
-     */
37
-    public function __construct(DateTimeInterface $timestamp)
38
-    {
39
-        $this->timestamp = $timestamp;
40
-    }
41
-
42
-    /**
43
-     * {@inheritdoc}
44
-     */
45
-    public function getFieldName(): string
46
-    {
47
-        return 'Date';
48
-    }
49
-
50
-    /**
51
-     * {@inheritdoc}
52
-     */
53
-    public function getFieldValue(): string
54
-    {
55
-        return $this->formatDateTime($this->timestamp);
56
-    }
27
+	/**
28
+	 * @var DateTimeInterface
29
+	 */
30
+	private DateTimeInterface $timestamp;
31
+
32
+	/**
33
+	 * Constructor of the class
34
+	 *
35
+	 * @param DateTimeInterface $timestamp
36
+	 */
37
+	public function __construct(DateTimeInterface $timestamp)
38
+	{
39
+		$this->timestamp = $timestamp;
40
+	}
41
+
42
+	/**
43
+	 * {@inheritdoc}
44
+	 */
45
+	public function getFieldName(): string
46
+	{
47
+		return 'Date';
48
+	}
49
+
50
+	/**
51
+	 * {@inheritdoc}
52
+	 */
53
+	public function getFieldValue(): string
54
+	{
55
+		return $this->formatDateTime($this->timestamp);
56
+	}
57 57
 }
Please login to merge, or discard this patch.
src/Header/AccessControlAllowOriginHeader.php 1 patch
Indentation   +66 added lines, -66 removed lines patch added patch discarded remove patch
@@ -31,77 +31,77 @@
 block discarded – undo
31 31
 class AccessControlAllowOriginHeader extends Header
32 32
 {
33 33
 
34
-    /**
35
-     * @var UriInterface|null
36
-     */
37
-    private ?UriInterface $uri = null;
34
+	/**
35
+	 * @var UriInterface|null
36
+	 */
37
+	private ?UriInterface $uri = null;
38 38
 
39
-    /**
40
-     * Constructor of the class
41
-     *
42
-     * @param mixed $uri
43
-     *
44
-     * @throws InvalidUriException
45
-     *         If the URI isn't valid.
46
-     *
47
-     * @throws InvalidHeaderValueException
48
-     *         If the URI isn't valid.
49
-     */
50
-    public function __construct($uri = null)
51
-    {
52
-        if (isset($uri)) {
53
-            $uri = Uri::create($uri);
54
-            $this->validateUri($uri);
55
-            $this->uri = $uri;
56
-        }
57
-    }
39
+	/**
40
+	 * Constructor of the class
41
+	 *
42
+	 * @param mixed $uri
43
+	 *
44
+	 * @throws InvalidUriException
45
+	 *         If the URI isn't valid.
46
+	 *
47
+	 * @throws InvalidHeaderValueException
48
+	 *         If the URI isn't valid.
49
+	 */
50
+	public function __construct($uri = null)
51
+	{
52
+		if (isset($uri)) {
53
+			$uri = Uri::create($uri);
54
+			$this->validateUri($uri);
55
+			$this->uri = $uri;
56
+		}
57
+	}
58 58
 
59
-    /**
60
-     * {@inheritdoc}
61
-     */
62
-    public function getFieldName(): string
63
-    {
64
-        return 'Access-Control-Allow-Origin';
65
-    }
59
+	/**
60
+	 * {@inheritdoc}
61
+	 */
62
+	public function getFieldName(): string
63
+	{
64
+		return 'Access-Control-Allow-Origin';
65
+	}
66 66
 
67
-    /**
68
-     * {@inheritdoc}
69
-     */
70
-    public function getFieldValue(): string
71
-    {
72
-        if (!isset($this->uri)) {
73
-            return '*';
74
-        }
67
+	/**
68
+	 * {@inheritdoc}
69
+	 */
70
+	public function getFieldValue(): string
71
+	{
72
+		if (!isset($this->uri)) {
73
+			return '*';
74
+		}
75 75
 
76
-        $origin = $this->uri->getScheme() . ':';
77
-        $origin .= '//' . $this->uri->getHost();
76
+		$origin = $this->uri->getScheme() . ':';
77
+		$origin .= '//' . $this->uri->getHost();
78 78
 
79
-        $port = $this->uri->getPort();
80
-        if (isset($port)) {
81
-            $origin .= ':' . $port;
82
-        }
79
+		$port = $this->uri->getPort();
80
+		if (isset($port)) {
81
+			$origin .= ':' . $port;
82
+		}
83 83
 
84
-        return $origin;
85
-    }
84
+		return $origin;
85
+	}
86 86
 
87
-    /**
88
-     * Validates the given URI
89
-     *
90
-     * @param UriInterface $uri
91
-     *
92
-     * @return void
93
-     *
94
-     * @throws InvalidHeaderValueException
95
-     *         If the URI isn't valid.
96
-     */
97
-    private function validateUri(UriInterface $uri): void
98
-    {
99
-        if ($uri->getScheme() === '' || $uri->getHost() === '') {
100
-            throw new InvalidHeaderValueException(sprintf(
101
-                'The URI "%2$s" for the header "%1$s" is not valid',
102
-                $this->getFieldName(),
103
-                $uri->__toString()
104
-            ));
105
-        }
106
-    }
87
+	/**
88
+	 * Validates the given URI
89
+	 *
90
+	 * @param UriInterface $uri
91
+	 *
92
+	 * @return void
93
+	 *
94
+	 * @throws InvalidHeaderValueException
95
+	 *         If the URI isn't valid.
96
+	 */
97
+	private function validateUri(UriInterface $uri): void
98
+	{
99
+		if ($uri->getScheme() === '' || $uri->getHost() === '') {
100
+			throw new InvalidHeaderValueException(sprintf(
101
+				'The URI "%2$s" for the header "%1$s" is not valid',
102
+				$this->getFieldName(),
103
+				$uri->__toString()
104
+			));
105
+		}
106
+	}
107 107
 }
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 InvalidHeaderValueException
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 InvalidHeaderValueException
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 InvalidHeaderValueException
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 InvalidHeaderValueException(
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 InvalidHeaderValueException
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 InvalidHeaderValueException(
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 InvalidHeaderValueException(
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 InvalidHeaderValueException(
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 InvalidHeaderValueException(
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 InvalidHeaderValueException(
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/WarningHeader.php 2 patches
Indentation   +98 added lines, -98 removed lines patch added patch discarded remove patch
@@ -29,102 +29,102 @@
 block discarded – undo
29 29
 class WarningHeader extends Header
30 30
 {
31 31
 
32
-    /**
33
-     * HTTP Warning Codes
34
-     *
35
-     * @link https://www.iana.org/assignments/http-warn-codes/http-warn-codes.xhtml
36
-     */
37
-    public const HTTP_WARNING_CODE_RESPONSE_IS_STALE = 110;
38
-    public const HTTP_WARNING_CODE_REVALIDATION_FAILED = 111;
39
-    public const HTTP_WARNING_CODE_DISCONNECTED_OPERATION = 112;
40
-    public const HTTP_WARNING_CODE_HEURISTIC_EXPIRATION = 113;
41
-    public const HTTP_WARNING_CODE_MISCELLANEOUS_WARNING = 199;
42
-    public const HTTP_WARNING_CODE_TRANSFORMATION_APPLIED = 214;
43
-    public const HTTP_WARNING_CODE_MISCELLANEOUS_PERSISTENT_WARNING = 299;
44
-
45
-    /**
46
-     * @var int
47
-     */
48
-    private int $code;
49
-
50
-    /**
51
-     * @var string
52
-     */
53
-    private string $agent;
54
-
55
-    /**
56
-     * @var string
57
-     */
58
-    private string $text;
59
-
60
-    /**
61
-     * @var DateTimeInterface|null
62
-     */
63
-    private ?DateTimeInterface $date;
64
-
65
-    /**
66
-     * Constructor of the class
67
-     *
68
-     * @param int $code
69
-     * @param string $agent
70
-     * @param string $text
71
-     * @param DateTimeInterface|null $date
72
-     *
73
-     * @throws InvalidHeaderValueException
74
-     *         If one of parameters isn't valid.
75
-     */
76
-    public function __construct(int $code, string $agent, string $text, ?DateTimeInterface $date = null)
77
-    {
78
-        $this->validateCode($code);
79
-        $this->validateToken($agent);
80
-        $this->validateQuotedString($text);
81
-
82
-        $this->code = $code;
83
-        $this->agent = $agent;
84
-        $this->text = $text;
85
-        $this->date = $date;
86
-    }
87
-
88
-    /**
89
-     * {@inheritdoc}
90
-     */
91
-    public function getFieldName(): string
92
-    {
93
-        return 'Warning';
94
-    }
95
-
96
-    /**
97
-     * {@inheritdoc}
98
-     */
99
-    public function getFieldValue(): string
100
-    {
101
-        $value = sprintf('%s %s "%s"', $this->code, $this->agent, $this->text);
102
-
103
-        if (isset($this->date)) {
104
-            $value .= sprintf(' "%s"', $this->formatDateTime($this->date));
105
-        }
106
-
107
-        return $value;
108
-    }
109
-
110
-    /**
111
-     * Validates the given code
112
-     *
113
-     * @param int $code
114
-     *
115
-     * @return void
116
-     *
117
-     * @throws InvalidHeaderValueException
118
-     *         If the code isn't valid.
119
-     */
120
-    private function validateCode(int $code): void
121
-    {
122
-        if (! ($code >= 100 && $code <= 999)) {
123
-            throw new InvalidHeaderValueException(sprintf(
124
-                'The code "%2$d" for the header "%1$s" is not valid',
125
-                $this->getFieldName(),
126
-                $code
127
-            ));
128
-        }
129
-    }
32
+	/**
33
+	 * HTTP Warning Codes
34
+	 *
35
+	 * @link https://www.iana.org/assignments/http-warn-codes/http-warn-codes.xhtml
36
+	 */
37
+	public const HTTP_WARNING_CODE_RESPONSE_IS_STALE = 110;
38
+	public const HTTP_WARNING_CODE_REVALIDATION_FAILED = 111;
39
+	public const HTTP_WARNING_CODE_DISCONNECTED_OPERATION = 112;
40
+	public const HTTP_WARNING_CODE_HEURISTIC_EXPIRATION = 113;
41
+	public const HTTP_WARNING_CODE_MISCELLANEOUS_WARNING = 199;
42
+	public const HTTP_WARNING_CODE_TRANSFORMATION_APPLIED = 214;
43
+	public const HTTP_WARNING_CODE_MISCELLANEOUS_PERSISTENT_WARNING = 299;
44
+
45
+	/**
46
+	 * @var int
47
+	 */
48
+	private int $code;
49
+
50
+	/**
51
+	 * @var string
52
+	 */
53
+	private string $agent;
54
+
55
+	/**
56
+	 * @var string
57
+	 */
58
+	private string $text;
59
+
60
+	/**
61
+	 * @var DateTimeInterface|null
62
+	 */
63
+	private ?DateTimeInterface $date;
64
+
65
+	/**
66
+	 * Constructor of the class
67
+	 *
68
+	 * @param int $code
69
+	 * @param string $agent
70
+	 * @param string $text
71
+	 * @param DateTimeInterface|null $date
72
+	 *
73
+	 * @throws InvalidHeaderValueException
74
+	 *         If one of parameters isn't valid.
75
+	 */
76
+	public function __construct(int $code, string $agent, string $text, ?DateTimeInterface $date = null)
77
+	{
78
+		$this->validateCode($code);
79
+		$this->validateToken($agent);
80
+		$this->validateQuotedString($text);
81
+
82
+		$this->code = $code;
83
+		$this->agent = $agent;
84
+		$this->text = $text;
85
+		$this->date = $date;
86
+	}
87
+
88
+	/**
89
+	 * {@inheritdoc}
90
+	 */
91
+	public function getFieldName(): string
92
+	{
93
+		return 'Warning';
94
+	}
95
+
96
+	/**
97
+	 * {@inheritdoc}
98
+	 */
99
+	public function getFieldValue(): string
100
+	{
101
+		$value = sprintf('%s %s "%s"', $this->code, $this->agent, $this->text);
102
+
103
+		if (isset($this->date)) {
104
+			$value .= sprintf(' "%s"', $this->formatDateTime($this->date));
105
+		}
106
+
107
+		return $value;
108
+	}
109
+
110
+	/**
111
+	 * Validates the given code
112
+	 *
113
+	 * @param int $code
114
+	 *
115
+	 * @return void
116
+	 *
117
+	 * @throws InvalidHeaderValueException
118
+	 *         If the code isn't valid.
119
+	 */
120
+	private function validateCode(int $code): void
121
+	{
122
+		if (! ($code >= 100 && $code <= 999)) {
123
+			throw new InvalidHeaderValueException(sprintf(
124
+				'The code "%2$d" for the header "%1$s" is not valid',
125
+				$this->getFieldName(),
126
+				$code
127
+			));
128
+		}
129
+	}
130 130
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -119,7 +119,7 @@
 block discarded – undo
119 119
      */
120 120
     private function validateCode(int $code): void
121 121
     {
122
-        if (! ($code >= 100 && $code <= 999)) {
122
+        if (!($code >= 100 && $code <= 999)) {
123 123
             throw new InvalidHeaderValueException(sprintf(
124 124
                 'The code "%2$d" for the header "%1$s" is not valid',
125 125
                 $this->getFieldName(),
Please login to merge, or discard this patch.
src/Header/TransferEncodingHeader.php 1 patch
Indentation   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -28,51 +28,51 @@
 block discarded – undo
28 28
 class TransferEncodingHeader extends Header
29 29
 {
30 30
 
31
-    /**
32
-     * Directives
33
-     *
34
-     * @var string
35
-     */
36
-    public const CHUNKED = 'chunked';
37
-    public const COMPRESS = 'compress';
38
-    public const DEFLATE = 'deflate';
39
-    public const GZIP = 'gzip';
31
+	/**
32
+	 * Directives
33
+	 *
34
+	 * @var string
35
+	 */
36
+	public const CHUNKED = 'chunked';
37
+	public const COMPRESS = 'compress';
38
+	public const DEFLATE = 'deflate';
39
+	public const GZIP = 'gzip';
40 40
 
41
-    /**
42
-     * @var list<string>
43
-     */
44
-    private array $directives;
41
+	/**
42
+	 * @var list<string>
43
+	 */
44
+	private array $directives;
45 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
-    public function __construct(string ...$directives)
55
-    {
56
-        /** @var list<string> $directives */
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
+	public function __construct(string ...$directives)
55
+	{
56
+		/** @var list<string> $directives */
57 57
 
58
-        $this->validateToken(...$directives);
58
+		$this->validateToken(...$directives);
59 59
 
60
-        $this->directives = $directives;
61
-    }
60
+		$this->directives = $directives;
61
+	}
62 62
 
63
-    /**
64
-     * {@inheritdoc}
65
-     */
66
-    public function getFieldName(): string
67
-    {
68
-        return 'Transfer-Encoding';
69
-    }
63
+	/**
64
+	 * {@inheritdoc}
65
+	 */
66
+	public function getFieldName(): string
67
+	{
68
+		return 'Transfer-Encoding';
69
+	}
70 70
 
71
-    /**
72
-     * {@inheritdoc}
73
-     */
74
-    public function getFieldValue(): string
75
-    {
76
-        return implode(', ', $this->directives);
77
-    }
71
+	/**
72
+	 * {@inheritdoc}
73
+	 */
74
+	public function getFieldValue(): string
75
+	{
76
+		return implode(', ', $this->directives);
77
+	}
78 78
 }
Please login to merge, or discard this patch.
src/Header/ContentSecurityPolicyHeader.php 1 patch
Indentation   +61 added lines, -61 removed lines patch added patch discarded remove patch
@@ -29,73 +29,73 @@
 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 InvalidHeaderValueParameterException
61
-     *         If the parameters aren't valid.
62
-     */
63
-    public function __construct(array $parameters = [])
64
-    {
65
-        $parameters = $this->validateParametersByRegex(
66
-            $parameters,
67
-            self::VALID_DIRECTIVE_NAME,
68
-            self::VALID_DIRECTIVE_VALUE
69
-        );
55
+	/**
56
+	 * Constructor of the class
57
+	 *
58
+	 * @param array<array-key, mixed> $parameters
59
+	 *
60
+	 * @throws InvalidHeaderValueParameterException
61
+	 *         If the parameters aren't valid.
62
+	 */
63
+	public function __construct(array $parameters = [])
64
+	{
65
+		$parameters = $this->validateParametersByRegex(
66
+			$parameters,
67
+			self::VALID_DIRECTIVE_NAME,
68
+			self::VALID_DIRECTIVE_VALUE
69
+		);
70 70
 
71
-        $this->parameters = $parameters;
72
-    }
71
+		$this->parameters = $parameters;
72
+	}
73 73
 
74
-    /**
75
-     * {@inheritdoc}
76
-     */
77
-    public function getFieldName(): string
78
-    {
79
-        return 'Content-Security-Policy';
80
-    }
74
+	/**
75
+	 * {@inheritdoc}
76
+	 */
77
+	public function getFieldName(): string
78
+	{
79
+		return 'Content-Security-Policy';
80
+	}
81 81
 
82
-    /**
83
-     * {@inheritdoc}
84
-     */
85
-    public function getFieldValue(): string
86
-    {
87
-        $directives = [];
88
-        foreach ($this->parameters as $directive => $value) {
89
-            // the directive can be without value...
90
-            // e.g. sandbox, upgrade-insecure-requests, etc.
91
-            if ($value === '') {
92
-                $directives[] = $directive;
93
-                continue;
94
-            }
82
+	/**
83
+	 * {@inheritdoc}
84
+	 */
85
+	public function getFieldValue(): string
86
+	{
87
+		$directives = [];
88
+		foreach ($this->parameters as $directive => $value) {
89
+			// the directive can be without value...
90
+			// e.g. sandbox, upgrade-insecure-requests, etc.
91
+			if ($value === '') {
92
+				$directives[] = $directive;
93
+				continue;
94
+			}
95 95
 
96
-            $directives[] = sprintf('%s %s', $directive, $value);
97
-        }
96
+			$directives[] = sprintf('%s %s', $directive, $value);
97
+		}
98 98
 
99
-        return implode('; ', $directives);
100
-    }
99
+		return implode('; ', $directives);
100
+	}
101 101
 }
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,56 +31,56 @@
 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 InvalidHeaderValueParameterException
54
-     *         If the parameters aren't valid.
55
-     */
56
-    public function __construct($uri, array $parameters = [])
57
-    {
58
-        $uri = Uri::create($uri);
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 InvalidHeaderValueParameterException
54
+	 *         If the parameters aren't valid.
55
+	 */
56
+	public function __construct($uri, array $parameters = [])
57
+	{
58
+		$uri = Uri::create($uri);
59 59
 
60
-        $parameters = $this->validateParameters($parameters);
60
+		$parameters = $this->validateParameters($parameters);
61 61
 
62
-        $this->uri = $uri;
63
-        $this->parameters = $parameters;
64
-    }
62
+		$this->uri = $uri;
63
+		$this->parameters = $parameters;
64
+	}
65 65
 
66
-    /**
67
-     * {@inheritdoc}
68
-     */
69
-    public function getFieldName(): string
70
-    {
71
-        return 'Link';
72
-    }
66
+	/**
67
+	 * {@inheritdoc}
68
+	 */
69
+	public function getFieldName(): string
70
+	{
71
+		return 'Link';
72
+	}
73 73
 
74
-    /**
75
-     * {@inheritdoc}
76
-     */
77
-    public function getFieldValue(): string
78
-    {
79
-        $v = sprintf('<%s>', $this->uri->__toString());
80
-        foreach ($this->parameters as $name => $value) {
81
-            $v .= sprintf('; %s="%s"', $name, $value);
82
-        }
74
+	/**
75
+	 * {@inheritdoc}
76
+	 */
77
+	public function getFieldValue(): string
78
+	{
79
+		$v = sprintf('<%s>', $this->uri->__toString());
80
+		foreach ($this->parameters as $name => $value) {
81
+			$v .= sprintf('; %s="%s"', $name, $value);
82
+		}
83 83
 
84
-        return $v;
85
-    }
84
+		return $v;
85
+	}
86 86
 }
Please login to merge, or discard this patch.
src/Header/ContentMD5Header.php 1 patch
Indentation   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -23,48 +23,48 @@
 block discarded – undo
23 23
 class ContentMD5Header extends Header
24 24
 {
25 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\+\/]+=*$/';
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 34
 
35
-    /**
36
-     * @var string
37
-     */
38
-    private string $value;
35
+	/**
36
+	 * @var string
37
+	 */
38
+	private string $value;
39 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
-    public function __construct(string $value)
49
-    {
50
-        $this->validateValueByRegex(self::RFC2045_MD5_DIGEST, $value);
40
+	/**
41
+	 * Constructor of the class
42
+	 *
43
+	 * @param string $value
44
+	 *
45
+	 * @throws InvalidHeaderValueException
46
+	 *         If the value isn't valid.
47
+	 */
48
+	public function __construct(string $value)
49
+	{
50
+		$this->validateValueByRegex(self::RFC2045_MD5_DIGEST, $value);
51 51
 
52
-        $this->value = $value;
53
-    }
52
+		$this->value = $value;
53
+	}
54 54
 
55
-    /**
56
-     * {@inheritdoc}
57
-     */
58
-    public function getFieldName(): string
59
-    {
60
-        return 'Content-MD5';
61
-    }
55
+	/**
56
+	 * {@inheritdoc}
57
+	 */
58
+	public function getFieldName(): string
59
+	{
60
+		return 'Content-MD5';
61
+	}
62 62
 
63
-    /**
64
-     * {@inheritdoc}
65
-     */
66
-    public function getFieldValue(): string
67
-    {
68
-        return $this->value;
69
-    }
63
+	/**
64
+	 * {@inheritdoc}
65
+	 */
66
+	public function getFieldValue(): string
67
+	{
68
+		return $this->value;
69
+	}
70 70
 }
Please login to merge, or discard this patch.