Passed
Push — master ( 1ae1d9...d63fc8 )
by Roeland
12:34 queued 12s
created
lib/private/Security/Hasher.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 		}
79 79
 
80 80
 		$hashingCost = $this->config->getSystemValue('hashingCost', null);
81
-		if(!\is_null($hashingCost)) {
81
+		if (!\is_null($hashingCost)) {
82 82
 			$this->options['cost'] = $hashingCost;
83 83
 		}
84 84
 	}
@@ -95,10 +95,10 @@  discard block
 block discarded – undo
95 95
 		$alg = $this->getPrefferedAlgorithm();
96 96
 
97 97
 		if (\defined('PASSWORD_ARGON2I') && $alg === PASSWORD_ARGON2I) {
98
-			return 2 . '|' . password_hash($message, PASSWORD_ARGON2I, $this->options);
98
+			return 2.'|'.password_hash($message, PASSWORD_ARGON2I, $this->options);
99 99
 		}
100 100
 
101
-		return 1 . '|' . password_hash($message, PASSWORD_BCRYPT, $this->options);
101
+		return 1.'|'.password_hash($message, PASSWORD_BCRYPT, $this->options);
102 102
 	}
103 103
 
104 104
 	/**
@@ -108,9 +108,9 @@  discard block
 block discarded – undo
108 108
 	 */
109 109
 	protected function splitHash(string $prefixedHash) {
110 110
 		$explodedString = explode('|', $prefixedHash, 2);
111
-		if(\count($explodedString) === 2) {
112
-			if((int)$explodedString[0] > 0) {
113
-				return ['version' => (int)$explodedString[0], 'hash' => $explodedString[1]];
111
+		if (\count($explodedString) === 2) {
112
+			if ((int) $explodedString[0] > 0) {
113
+				return ['version' => (int) $explodedString[0], 'hash' => $explodedString[1]];
114 114
 			}
115 115
 		}
116 116
 
@@ -125,13 +125,13 @@  discard block
 block discarded – undo
125 125
 	 * @return bool Whether $hash is a valid hash of $message
126 126
 	 */
127 127
 	protected function legacyHashVerify($message, $hash, &$newHash = null): bool {
128
-		if(empty($this->legacySalt)) {
128
+		if (empty($this->legacySalt)) {
129 129
 			$this->legacySalt = $this->config->getSystemValue('passwordsalt', '');
130 130
 		}
131 131
 
132 132
 		// Verify whether it matches a legacy PHPass or SHA1 string
133 133
 		$hashLength = \strlen($hash);
134
-		if(($hashLength === 60 && password_verify($message.$this->legacySalt, $hash)) ||
134
+		if (($hashLength === 60 && password_verify($message.$this->legacySalt, $hash)) ||
135 135
 			($hashLength === 40 && hash_equals($hash, sha1($message)))) {
136 136
 			$newHash = $this->hash($message);
137 137
 			return true;
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
 	 * @return bool Whether $hash is a valid hash of $message
149 149
 	 */
150 150
 	protected function verifyHashV1(string $message, string $hash, &$newHash = null): bool {
151
-		if(password_verify($message, $hash)) {
151
+		if (password_verify($message, $hash)) {
152 152
 			if ($this->needsRehash($hash)) {
153 153
 				$newHash = $this->hash($message);
154 154
 			}
@@ -166,8 +166,8 @@  discard block
 block discarded – undo
166 166
 	 * @return bool Whether $hash is a valid hash of $message
167 167
 	 */
168 168
 	protected function verifyHashV2(string $message, string $hash, &$newHash = null) : bool {
169
-		if(password_verify($message, $hash)) {
170
-			if($this->needsRehash($hash)) {
169
+		if (password_verify($message, $hash)) {
170
+			if ($this->needsRehash($hash)) {
171 171
 				$newHash = $this->hash($message);
172 172
 			}
173 173
 			return true;
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
 	public function verify(string $message, string $hash, &$newHash = null): bool {
186 186
 		$splittedHash = $this->splitHash($hash);
187 187
 
188
-		if(isset($splittedHash['version'])) {
188
+		if (isset($splittedHash['version'])) {
189 189
 			switch ($splittedHash['version']) {
190 190
 				case 2:
191 191
 					return $this->verifyHashV2($message, $splittedHash['hash'], $newHash);
Please login to merge, or discard this patch.