Code Duplication    Length = 5-5 lines in 2 locations

lib/Controller/PushController.php 2 locations

@@ 98-102 (lines=5) @@
95
			return new JSONResponse(['message' => 'Invalid hashed push token'], Http::STATUS_BAD_REQUEST);
96
		}
97
98
		if (strlen($devicePublicKey) !== 450 ||
99
			strpos($devicePublicKey, '-----BEGIN PUBLIC KEY-----') !== 0 ||
100
			strpos($devicePublicKey, '-----END PUBLIC KEY-----') !== 426) {
101
			return new JSONResponse(['message' => 'Invalid device public key'], Http::STATUS_BAD_REQUEST);
102
		}
103
104
		$tokenId = $this->session->get('token-id');
105
		try {
@@ 140-144 (lines=5) @@
137
			return new JSONResponse([], Http::STATUS_UNAUTHORIZED);
138
		}
139
140
		if (strlen($devicePublicKey) !== 450 ||
141
			strpos($devicePublicKey, '-----BEGIN PUBLIC KEY-----') !== 0 ||
142
			strpos($devicePublicKey, '-----END PUBLIC KEY-----') !== 426) {
143
			return new JSONResponse(['message' => 'Invalid device public key'], Http::STATUS_BAD_REQUEST);
144
		}
145
146
		$sessionId = $this->session->getId();
147
		try {