public function getAllURLs(bool $doNotShuffle = false) : array
{
$state = State::instance();
$candidates = [];
if ($state->universal['tor-only']) {
// Prioritize Tor Hidden Services
$after = [];
foreach ($this->urls as $url) {
if (\Airship\isOnionUrl($url)) {
$candidates[] = $url;
} else {
$after[] = $url;
}
}
// Shuffle each array separately, to maintain priority;
if (!$doNotShuffle) {
\Airship\secure_shuffle($candidates);
\Airship\secure_shuffle($after);
}
foreach ($after as $url) {
$candidates[] = $url;
}
} else {
// All URLs treated the same.
$candidates = $this->urls;
if (!$doNotShuffle) {
\Airship\secure_shuffle($candidates);
}
}
return $candidates;
}