/** * @param string $uuid * @param null|string $username * @param null|null $password * * @return bool|int Returns false on an unexpected failure or the number of rows affected */ public function updateByUuid($uuid, $username = null, $password = null) { if ($username === null && $password === null) { return 0; } $sql = 'UPDATE auth SET'; $placeholders = []; if ($username !== null) { $sql .= ' username = :username'; $placeholders[':username'] = $username; } if ($password !== null) { $sql .= ' password = :password'; $placeholders[':password'] = $password; } $sql .= ' WHERE uuid = :uuid'; $placeholders[':uuid'] = $uuid; return parent::update($sql, $placeholders); }