Code Duplication    Length = 12-12 lines in 2 locations

lib/private/Authentication/Token/DefaultTokenProvider.php 1 location

@@ 133-144 (lines=12) @@
130
	 * @throws InvalidTokenException
131
	 * @param IToken $token
132
	 */
133
	public function updateTokenActivity(IToken $token) {
134
		if (!($token instanceof DefaultToken)) {
135
			throw new InvalidTokenException();
136
		}
137
		/** @var DefaultToken $token */
138
		$now = $this->time->getTime();
139
		if ($token->getLastActivity() < ($now - 60)) {
140
			// Update token only once per minute
141
			$token->setLastActivity($now);
142
			$this->mapper->update($token);
143
		}
144
	}
145
146
	public function getTokenByUser(string $uid): array {
147
		return $this->mapper->getTokenByUser($uid);

lib/private/Authentication/Token/PublicKeyTokenProvider.php 1 location

@@ 154-165 (lines=12) @@
151
		$this->mapper->update($token);
152
	}
153
154
	public function updateTokenActivity(IToken $token) {
155
		if (!($token instanceof PublicKeyToken)) {
156
			throw new InvalidTokenException();
157
		}
158
		/** @var DefaultToken $token */
159
		$now = $this->time->getTime();
160
		if ($token->getLastActivity() < ($now - 60)) {
161
			// Update token only once per minute
162
			$token->setLastActivity($now);
163
			$this->mapper->update($token);
164
		}
165
	}
166
167
	public function getTokenByUser(string $uid): array {
168
		return $this->mapper->getTokenByUser($uid);