fix(binance): plus some other tweaks (#3753)

This commit is contained in:
Dag 2023-10-13 20:48:08 +02:00 committed by GitHub
parent fd52b9b9a4
commit 5f37c72be0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 46 additions and 53 deletions

View file

@ -260,13 +260,15 @@ class FeedItem
return $this->uid;
}
public function setUid($uid)
public function setUid($uid): void
{
$this->uid = null;
if (!is_string($uid)) {
Debug::log('Unique id must be a string!');
} elseif (preg_match('/^[a-f0-9]{40}$/', $uid)) {
// keep id if it already is SHA-1 hash
Debug::log(sprintf('uid must be string: %s (%s)', (string) $uid, var_export($uid, true)));
return;
}
if (preg_match('/^[a-f0-9]{40}$/', $uid)) {
// Preserve sha1 hash
$this->uid = $uid;
} else {
$this->uid = sha1($uid);