shaarliFeed = $feed->load($params['config']['fetching']['Shaarli']); $this->shaarliFeedUpdate = $feed->lastUpdate(); $this->numberEntry = $params['config']['numberOfLastItem']; return $this; } /** * Retrieves the latest images from the Shaarli feed * * @return array $bookmakList Array of last bookmark */ public function getLastBookmark(): array { $totalEntry = count($this->shaarliFeed->xml->entry); if ($totalEntry <= $this->numberEntry) { $needItem = $totalEntry; } else { $needItem = $this->numberEntry; } for ($i = 0; $i < $needItem; $i++) { $bookmarkList[] = [ 'title' => (string)$this->shaarliFeed->xml->entry[$i]->title[0], 'link' => (string)$this->shaarliFeed->xml->entry[$i]->link[0]->attributes()[0], 'permalink' => (string)$this->shaarliFeed->xml->entry[$i]->id[0], ]; } $this->bookmarkList = $bookmarkList; return $bookmarkList; } /** * Generates an HTML list of images from the images list * * @return string|null Returns the generated HTML string of images */ public function makeList(): ?string { if (!empty($this->bookmarkList)) { $htmlBookmark = ''; return $htmlBookmark; } return null; } }