@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | { |
55 | 55 | $this->constraints[] = new CountConstraint($min, $max, $weight); |
56 | 56 | |
57 | - StableSort::usort($this->constraints, static function (CountConstraint $a, CountConstraint $b): int { |
|
57 | + StableSort::usort($this->constraints, static function(CountConstraint $a, CountConstraint $b): int { |
|
58 | 58 | return $b->getWeight() <=> $a->getWeight(); |
59 | 59 | }); |
60 | 60 | |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | */ |
108 | 108 | public function test($password, ?int $weight = null): bool |
109 | 109 | { |
110 | - $count = $this->getCount((string)$password); |
|
110 | + $count = $this->getCount((string) $password); |
|
111 | 111 | $constraint = $this->getViolation($count, $weight); |
112 | 112 | |
113 | 113 | return $constraint === null; |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | */ |
119 | 119 | public function validate($password, TranslatorInterface $translator): ?ValidationError |
120 | 120 | { |
121 | - $count = $this->getCount((string)$password); |
|
121 | + $count = $this->getCount((string) $password); |
|
122 | 122 | $constraint = $this->getViolation($count); |
123 | 123 | |
124 | 124 | if ($constraint !== null) { |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | |
166 | 166 | try { |
167 | 167 | $requestFactory = $this->getRequestFactory(); |
168 | - $request = $requestFactory->createRequest('GET', 'https://api.pwnedpasswords.com/range/' . $prefix); |
|
168 | + $request = $requestFactory->createRequest('GET', 'https://api.pwnedpasswords.com/range/'.$prefix); |
|
169 | 169 | |
170 | 170 | $client = $this->getClient(); |
171 | 171 | |
@@ -175,14 +175,14 @@ discard block |
||
175 | 175 | $lines = explode("\r\n", $contents); |
176 | 176 | foreach ($lines as $line) { |
177 | 177 | if (substr($line, 0, 35) === $suffix) { |
178 | - return (int)substr($line, 36); |
|
178 | + return (int) substr($line, 36); |
|
179 | 179 | } |
180 | 180 | } |
181 | 181 | return 0; |
182 | 182 | } catch (ClientExceptionInterface | RuntimeException $exception) { |
183 | 183 | throw new CouldNotUseRuleException( |
184 | 184 | $this, |
185 | - 'An error occurred while using the Have I Been Pwned? service: ' . $exception->getMessage(), |
|
185 | + 'An error occurred while using the Have I Been Pwned? service: '.$exception->getMessage(), |
|
186 | 186 | $exception |
187 | 187 | ); |
188 | 188 | } |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | { |
199 | 199 | if ($constraint->getMax() === null) { |
200 | 200 | return $translator->trans( |
201 | - 'The password must appear at least once in data breaches.|' . |
|
201 | + 'The password must appear at least once in data breaches.|'. |
|
202 | 202 | 'The password must appear at least %count% times in data breaches.', |
203 | 203 | ['%count%' => $constraint->getMin()] |
204 | 204 | ); |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | |
213 | 213 | if ($constraint->getMin() === 0) { |
214 | 214 | return $translator->trans( |
215 | - 'The password must appear at most once in data breaches.|' . |
|
215 | + 'The password must appear at most once in data breaches.|'. |
|
216 | 216 | 'The password must appear at most %count% times in data breaches.', |
217 | 217 | ['%count%' => $constraint->getMax()] |
218 | 218 | ); |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | |
221 | 221 | if ($constraint->getMin() === $constraint->getMax()) { |
222 | 222 | return $translator->trans( |
223 | - 'The password must appear exactly once in data breaches.|' . |
|
223 | + 'The password must appear exactly once in data breaches.|'. |
|
224 | 224 | 'The password must appear exactly %count% times in data breaches.', |
225 | 225 | ['%count%' => $constraint->getMin()] |
226 | 226 | ); |
@@ -46,7 +46,7 @@ |
||
46 | 46 | foreach ($parts2 as $part2) { |
47 | 47 | foreach ($parts3 as $part3) { |
48 | 48 | foreach (self::SEPARATORS as $separator) { |
49 | - $this->formats[] = $part1 . $separator . $part2 . $separator . $part3; |
|
49 | + $this->formats[] = $part1.$separator.$part2.$separator.$part3; |
|
50 | 50 | } |
51 | 51 | } |
52 | 52 | } |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | { |
48 | 48 | $this->constraints[] = new PositionConstraint($first, $count, $weight); |
49 | 49 | |
50 | - StableSort::usort($this->constraints, static function (PositionConstraint $a, PositionConstraint $b): int { |
|
50 | + StableSort::usort($this->constraints, static function(PositionConstraint $a, PositionConstraint $b): int { |
|
51 | 51 | return $b->getWeight() <=> $a->getWeight(); |
52 | 52 | }); |
53 | 53 | |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | $position = 0; |
135 | 135 | foreach ($password->getFormerPasswords() as $formerPassword) { |
136 | 136 | $passwordHash = $formerPassword->getHash(); |
137 | - if ($passwordHash !== null && $this->hashFunction->compare((string)$password, $passwordHash)) { |
|
137 | + if ($passwordHash !== null && $this->hashFunction->compare((string) $password, $passwordHash)) { |
|
138 | 138 | $positions[] = $position; |
139 | 139 | } |
140 | 140 | ++$position; |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | } |
159 | 159 | |
160 | 160 | return $translator->trans( |
161 | - 'The most recently used password cannot be reused.|' . |
|
161 | + 'The most recently used password cannot be reused.|'. |
|
162 | 162 | 'The %count% most recently used passwords cannot be reused.', |
163 | 163 | ['%count%' => $constraint->getCount()] |
164 | 164 | ); |