diff --git a/bridges/DonnonsBridge.php b/bridges/DonnonsBridge.php
index a33a10132c8..1afdc4f2f71 100644
--- a/bridges/DonnonsBridge.php
+++ b/bridges/DonnonsBridge.php
@@ -1,5 +1,7 @@
getPageURI($page);
- $html = getSimpleHTMLDOM($uri);
-
- $searchDiv = $html->find('div[id=search]', 0);
-
- if (!is_null($searchDiv)) {
- $elements = $searchDiv->find('a.lst-annonce');
- foreach ($elements as $element) {
- $item = [];
-
- // Lien vers le don
- $item['uri'] = self::URI . $element->href;
- // Id de l'objet
- $item['uid'] = $element->getAttribute('data-id');
-
- // Grab info from json
- $jsonString = $element->find('script', 0)->innertext;
- $json = json_decode($jsonString, true);
-
- $name = $json['name'];
- $category = $json['category'];
- $date = $json['availabilityStarts'];
- $description = $json['description'];
- $city = $json['availableAtOrFrom']['address']['addressLocality'];
- $region = $json['availableAtOrFrom']['address']['addressRegion'];
-
- // Grab info from HTML
- $imageSrc = $element->find('img.ima-center', 0)->getAttribute('src');
- // Use large image instead of small one
- $imageSrc = str_replace('/xs/', '/lg/', $imageSrc);
- $image = self::URI . $imageSrc;
- $author = $element->find('div.avatar-holder', 0)->plaintext;
-
- $content = '
-
-
-
' . $name . '
-
' . $description . '
-
Lieu : ' . $city . ' - ' . $region . '
-
Par : ' . $author . '
-
Date : ' . $date . '
-
- ';
-
- // Titre du don
- $item['title'] = '[' . $category . '] ' . $name;
- $item['timestamp'] = $date;
- $item['author'] = $author;
- $item['content'] = $content;
- $item['enclosures'] = [$image];
-
- $this->items[] = $item;
- }
+ $dom = getSimpleHTMLDOM($uri);
+
+ $searchDiv = $dom->find('div[id=search]', 0);
+
+ if (! $searchDiv) {
+ return;
+ }
+
+ $elements = $searchDiv->find('a.lst-annonce');
+ foreach ($elements as $element) {
+ $item = [];
+
+ // Lien vers le don
+ $item['uri'] = self::URI . $element->href;
+ // Id de l'objet
+ $item['uid'] = $element->getAttribute('data-id');
+
+ // Grab info from json
+ $jsonString = $element->find('script', 0)->innertext;
+ $json = json_decode($jsonString, true);
+
+ $name = $json['name'];
+ $category = $json['category'];
+ $date = $json['availabilityStarts'];
+ $description = $json['description'];
+ $city = $json['availableAtOrFrom']['address']['addressLocality'];
+ $region = $json['availableAtOrFrom']['address']['addressRegion'];
+
+ // Grab info from HTML
+ $imageSrc = $element->find('img.ima-center', 0)->getAttribute('src');
+ // Use large image instead of small one
+ $imageSrc = str_replace('/xs/', '/lg/', $imageSrc);
+ $image = self::URI . $imageSrc;
+ $author = $element->find('div.avatar-holder', 0)->plaintext;
+
+ $content = '
+
+
+
' . $name . '
+
' . $description . '
+
Lieu : ' . $city . ' - ' . $region . '
+
Par : ' . $author . '
+
Date : ' . $date . '
+
+ ';
+
+ // Titre du don
+ $item['title'] = '[' . $category . '] ' . $name;
+ $item['timestamp'] = $date;
+ $item['author'] = $author;
+ $item['content'] = $content;
+ $item['enclosures'] = [$image];
+
+ $this->items[] = $item;
}
}