$row['to_go'] == 0 ? 'yes' : 'no', 'progress' => $progress, 'active_status' => $activeStatus, ]; } return $snatchedList; } public function renderProgressBar($activeStatus, $progress): string { $color = '#aaa'; if ($activeStatus == 'seeding') { $color = 'green'; } elseif ($activeStatus == 'leeching') { $color = 'blue'; } $progress = ($progress * 100) . '%'; $result = sprintf( '
', $activeStatus . " $progress", $progress, $color ); return $result; } public function renderTorrentsPageAverageRating(array $torrentInfo): string { static $ptGen; if (is_null($ptGen)) { $ptGen = new PTGen(); } $ptGenInfo = $torrentInfo['pt_gen']; if (!is_array($torrentInfo['pt_gen'])) { $ptGenInfo = json_decode($ptGenInfo, true); } $log = "torrent: " . $torrentInfo['id']; $siteIdAndRating = $ptGen->listRatings($ptGenInfo ?? [], $torrentInfo['url']); $log .= "siteIdAndRating: " . json_encode($siteIdAndRating); do_log($log); return $ptGen->buildRatingSpan($siteIdAndRating); } }