giteaFeed = $feed->load($params['config']['fetching']['Gitea']); $this->numberEntry = $params['config']['numberOfLastItem']; return $this; } /** * Retrieves a list of the most recently updated repositories that are not archived * * @return array List of repositories with their name, URL, and last update timestamp */ public function getLastRepo(): array { $repoList = []; if (count($this->giteaFeed->json) > 0) { foreach ($this->giteaFeed->json as $value) { if ($value['archived'] === false) { $timestamp = new \DateTimeImmutable($value['updated_at']); $timestamp = (int)$timestamp->format("U"); $repoList[$timestamp] = [ 'name' => $value['name'], 'url' => $value['html_url'], 'update_at' => $value['updated_at'] ]; } } krsort($repoList); $repoList = array_slice($repoList, 0, $this->numberEntry); $this->repoList = $repoList; } return $repoList; } /** * Generates an HTML list of repositories from the repo list * * @return string|null The HTML string of the repository list or null if the repo list is empty */ public function makeList(): ?string { if (!empty($this->repoList)) { $htmlRepo = ''; $this->giteaHash = sha1($htmlRepo); return $htmlRepo; } return null; } }