@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | { |
| 40 | 40 | $this->constraints[] = new CountConstraint($min, $max, $weight); |
| 41 | 41 | |
| 42 | - StableSort::usort($this->constraints, static function (CountConstraint $a, CountConstraint $b): int { |
|
| 42 | + StableSort::usort($this->constraints, static function(CountConstraint $a, CountConstraint $b): int { |
|
| 43 | 43 | return $b->getWeight() <=> $a->getWeight(); |
| 44 | 44 | }); |
| 45 | 45 | |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | */ |
| 56 | 56 | public function test($password, ?int $weight = 1): bool |
| 57 | 57 | { |
| 58 | - $count = $this->getCount((string)$password); |
|
| 58 | + $count = $this->getCount((string) $password); |
|
| 59 | 59 | $constraint = $this->getViolation($count, $weight); |
| 60 | 60 | |
| 61 | 61 | return $constraint === null; |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | */ |
| 71 | 71 | public function validate($password, TranslatorInterface $translator): ?ValidationError |
| 72 | 72 | { |
| 73 | - $count = $this->getCount((string)$password); |
|
| 73 | + $count = $this->getCount((string) $password); |
|
| 74 | 74 | $constraint = $this->getViolation($count); |
| 75 | 75 | |
| 76 | 76 | if ($constraint !== null) { |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | assert(count($passwordCharacters) === count($lowerCaseCharacters)); |
| 118 | 118 | |
| 119 | 119 | $count = 0; |
| 120 | - for ($i = count($passwordCharacters) - 1; $i >= 0; --$i) { |
|
| 120 | + for ($i = count($passwordCharacters)-1; $i >= 0; --$i) { |
|
| 121 | 121 | if ($passwordCharacters[$i] !== $lowerCaseCharacters[$i]) { |
| 122 | 122 | ++$count; |
| 123 | 123 | } |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | { |
| 149 | 149 | if ($constraint->getMax() === null) { |
| 150 | 150 | return $translator->trans( |
| 151 | - 'The password must contain at least one upper case letter.|' . |
|
| 151 | + 'The password must contain at least one upper case letter.|'. |
|
| 152 | 152 | 'The password must contain at least %count% upper case letters.', |
| 153 | 153 | ['%count%' => $constraint->getMin()] |
| 154 | 154 | ); |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | |
| 163 | 163 | if ($constraint->getMin() === 0) { |
| 164 | 164 | return $translator->trans( |
| 165 | - 'The password must contain at most one upper case letter.|' . |
|
| 165 | + 'The password must contain at most one upper case letter.|'. |
|
| 166 | 166 | 'The password must contain at most %count% upper case letters.', |
| 167 | 167 | ['%count%' => $constraint->getMax()] |
| 168 | 168 | ); |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | |
| 171 | 171 | if ($constraint->getMin() === $constraint->getMax()) { |
| 172 | 172 | return $translator->trans( |
| 173 | - 'The password must contain exactly one upper case letter.|' . |
|
| 173 | + 'The password must contain exactly one upper case letter.|'. |
|
| 174 | 174 | 'The password must contain exactly %count% upper case letters.', |
| 175 | 175 | ['%count%' => $constraint->getMin()] |
| 176 | 176 | ); |
@@ -96,8 +96,8 @@ |
||
| 96 | 96 | if ($this->translator === null) { |
| 97 | 97 | $this->translator = new Translator('en_US'); |
| 98 | 98 | $this->translator->addLoader('mo', new MoFileLoader()); |
| 99 | - $this->translator->addResource('mo', __DIR__ . '/../translations/messages.nn_NO.mo', 'nn_NO'); |
|
| 100 | - $this->translator->addResource('mo', __DIR__ . '/../translations/messages.nb_NO.mo', 'nb_NO'); |
|
| 99 | + $this->translator->addResource('mo', __DIR__.'/../translations/messages.nn_NO.mo', 'nn_NO'); |
|
| 100 | + $this->translator->addResource('mo', __DIR__.'/../translations/messages.nb_NO.mo', 'nb_NO'); |
|
| 101 | 101 | } |
| 102 | 102 | |
| 103 | 103 | return $this->translator; |